ankane / distribute_reads

Scale database reads to replicas in Rails

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can't distribute all reads in a job, or any file

justincarrao opened this issue · comments

Distribute all reads in a job with:

  distribute_reads

  def perform
    # ...
  end
end

This leads to the following error:
LocalJumpError: no block given (yield) from my_gem_path/distribute_reads/global_methods.rb:11:in `distribute_reads'

Hey @justincarrao, make sure:

  1. You're on the latest version
  2. You do this in an ActiveJob (not just any file)

@ankane Understood, thank you. I'm going to close this for now then.
Are there any plans going forward to add this functionality to any file?
For example, if some model is backed by a huge table and we want that specific model to always read from a replica, this would be a really nice feature.
I'd be happy to collaborate or put some time into this myself as well

@ankane it's been awhile this feature was requested. Wanna check the status of this feature.