-
Notifications
You must be signed in to change notification settings - Fork 143
Integration with Sidekiq
PikachuEXE edited this page Sep 13, 2017
·
2 revisions
This works since Marginalia::Comment
has API for "job"
And it just use the class name of "job" in comment
# Written like
# https://github.com/mperham/sidekiq/blob/5-0/lib/sidekiq/middleware/server/active_record.rb
class SidekiqMarginaliaIntegeration
def call(worker, _msg, _queue)
Marginalia::Comment.update_job!(worker)
yield
ensure
Marginalia::Comment.clear_job!
end
end
Sidekiq.configure_server do |config|
config.server_middleware do |chain|
chain.add(::SidekiqMarginaliaIntegeration)
end
end