Class: Fragmentary::Dispatcher

Inherits:
Object
  • Object
show all
Defined in:
lib/fragmentary/dispatcher.rb

Instance Method Summary collapse

Constructor Details

#initialize(tasks) ⇒ Dispatcher

Returns a new instance of Dispatcher.



4
5
6
# File 'lib/fragmentary/dispatcher.rb', line 4

def initialize(tasks)
  @tasks = tasks
end

Instance Method Details

#performObject



8
9
10
11
12
13
14
15
16
# File 'lib/fragmentary/dispatcher.rb', line 8

def perform
  @tasks.each do |task|
    Rails.logger.info "***** Dispatching task for handler class #{task.class.name}"
    task.call
  end
  RequestQueue.all.each do |queue|
    queue.start
  end
end