ankane / distribute_reads

Scale database reads to replicas in Rails

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Helper for Sidekiq Workers like DistributeReads::JobMethods

v-kumar opened this issue · comments

Hi,

Great job on this gem.

Have you thought about a helper module for Sidekiq Workers, like you have for ActiveJob in DistributeReads::JobMethods ?

We still use Sidekiq without ActiveJob.

Unfortunately, Sidekiq does not have a around hook like ActiveJobs, but they do support Middleware extensions. https://github.com/mperham/sidekiq/wiki/Middleware.

The simplest way would be to use a module that can be prepended or use a more sophisticated middleware.

I would be happy to discuss further.

Hey @v-kumar, thanks for the suggestion. I only plan to support ActiveJob, but feel free to share if you decide to create Sidekiq middleware.