yield
我的sidekiq客户端中间件中的代码似乎没有执行。没有引发异常(我正在捕获它),所以我无法想象代码是如何被跳过的(在 lambda 中也没有返回)。谁能解释为什么?这是中间件代码:
class SidekiqClientWorkless
def initialize(options = nil)
end
def call(worker, msg, queue)
Log.create!(task: "testing", message: "This message gets logged")
begin
yield
rescue Exception => e
require 'ruby-debug'
debugger
end
Log.create!(task: "testing", message: "This message does not get logged")
end
end
Sidekiq.configure_client do |config|
config.redis = { :url => 'redis://user:pwd@barb.redistogo.com:9725/',
:namespace => 'mynamespace' }
config.client_middleware do |chain|
chain.add SidekiqClientWorkless, :foo => 1, :bar => 2
end
end