我可以执行以下操作吗?如果是,我该如何实施in_sidekiq_job
?
def method_for_anyone_to_call
if in_sidekiq_job
puts "hey! I'm running in a Sidekiq job."
end
end
答案 0 :(得分:2)
您可以使用Sidekiq.server?
,即:
def method_for_anyone_to_call
if Sidekiq.server?
puts "hey! I'm running in a Sidekiq job."
end
end