Class: Textus::Surfaces::Watcher
- Inherits:
-
Object
- Object
- Textus::Surfaces::Watcher
- Defined in:
- lib/textus/surfaces/watcher.rb
Instance Method Summary collapse
-
#initialize(container:) ⇒ Watcher
constructor
A new instance of Watcher.
- #run(poll: nil) ⇒ Object
- #tick ⇒ Object
Constructor Details
Instance Method Details
#run(poll: nil) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/textus/surfaces/watcher.rb', line 23 def run(poll: nil) interval = poll || @container.manifest.data.worker_config[:poll] lock = Textus::Ports::WatcherLock.new(@container.root) lock.acquire begin loop do tick sleep(interval) end ensure lock.release end end |
#tick ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/textus/surfaces/watcher.rb', line 13 def tick Textus::Background::Planner::Plan.seed( container: @container, queue: @queue, role: Textus::Role::AUTOMATION, ) @queue.reclaim(now: Textus::Ports::Clock.new.now) Textus::Background::Worker.for(container: @container, queue: @queue).drain end |