Class: Async::Cron::Service::Scheduler

Inherits:
Service::Generic
  • Object
show all
Defined in:
lib/async/cron/service/scheduler.rb

Instance Method Summary collapse

Instance Method Details

#setup(container) ⇒ Object

Setup the container with the application instance.



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/async/cron/service/scheduler.rb', line 15

def setup(container)
  container_options = @evaluator.container_options
  
  container.run(name: self.name, **container_options) do |instance|
    evaluator = @environment.evaluator
    
    Async do |task|
      scheduler = evaluator.scheduler
      
      task = Async do
        scheduler.run
      end
      
      instance.ready!
      
      task.wait
    end
  end
end