Class: Legion::LLM::Inventory::Sweeper

Inherits:
Object
  • Object
show all
Includes:
Legion::Logging::Helper
Defined in:
lib/legion/llm/inventory/sweeper.rb

Overview

TTL safety net for the live inventory store. Runs every 30s to evict any lane whose expires_at has passed. This is a backstop for dead or crashed writer actors; ScopedRefresher’s write-then-delete-orphans pattern (G7) is the primary eviction path. Static-catalog lanes (expires_at: nil) are never swept.

Uses Inventory.expired_ids — never .send(:map) on the internal store (M3).

Constant Summary collapse

SWEEP_INTERVAL =
30

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.sweep!Object

Class-level entry point for direct invocation and spec use.



26
27
28
# File 'lib/legion/llm/inventory/sweeper.rb', line 26

def self.sweep!(**)
  new.send(:sweep!)
end

Instance Method Details

#manualObject

Every actor interface — called by the ::Every timer task.



36
37
38
# File 'lib/legion/llm/inventory/sweeper.rb', line 36

def manual(**)
  sweep!
end

#timeObject

Every actor interface — time (seconds between ticks).



31
32
33
# File 'lib/legion/llm/inventory/sweeper.rb', line 31

def time
  SWEEP_INTERVAL
end