Class: RoundRobin::Worker

Inherits:
Object
  • Object
show all
Defined in:
lib/round_robin/worker.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#shutdownObject

Returns the value of attribute shutdown.



3
4
5
# File 'lib/round_robin/worker.rb', line 3

def shutdown
  @shutdown
end

Instance Method Details

#pidObject



12
13
14
# File 'lib/round_robin/worker.rb', line 12

def pid
  Process.pid
end

#workObject



5
6
7
8
9
10
# File 'lib/round_robin/worker.rb', line 5

def work
  begin
    RoundRobin::Job.order("invoked_at").limit(1).first.try(:invoke_job)
    sleep sleep_time
  end while not shutdown
end