4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/sidekiq/batching/middleware.rb', line 4
def call(worker_class, msg, queue, redis_pool = nil)
worker_class = worker_class.classify.constantize if worker_class.is_a?(String)
options = worker_class.get_sidekiq_options
batch =
options.keys.include?('batch_size') ||
options.keys.include?('batch_flush_interval')
passthrough =
msg['args'] &&
msg['args'].is_a?(Array) &&
msg['args'].try(:first) == true
if batch && not(passthrough)
add_to_batch(worker_class, queue, msg, redis_pool)
else
if batch && passthrough
msg['args'].shift
end
yield
end
end
|