6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/shinq/launcher.rb', line 6
def run
worker_name = Shinq.configuration.worker_name
worker_class = worker_name.camelize.constantize
@loop_count = 0
until @stop
queue = Shinq::Client.dequeue(table_name: worker_name.pluralize)
next Shinq.logger.info("Queue is empty (#{Time.now})") unless queue
begin
worker_class.new.perform(queue)
rescue => e
Shinq::Client.abort
raise e
end
Shinq::Client.done
@loop_count += 1
if lifecycle_limit?
Shinq.logger.info("Lifecycle Limit pid(#{Process.pid})")
break
end
end
end
|