brandonhilkert / sucker_punch

Sucker Punch is a Ruby asynchronous processing library using concurrent-ruby, heavily influenced by Sidekiq and girl_friday.
MIT License
2.64k stars 114 forks source link

update rails advice to use executor or reloader? #247

Closed jjb closed 2 years ago

jjb commented 2 years ago

The readme shows how to manually achieve the most important parts of that. Maybe it should be updated to use the rails executor or reloader instead?

Prior to Rails 5.0, some of these were handled by separate Rack middleware classes (such as ActiveRecord::ConnectionAdapters::ConnectionManagement), or directly wrapping code with methods like ActiveRecord::Base.connection_pool.with_connection. The Executor replaces these with a single more abstract interface.

jjb commented 2 years ago

Then again...

Rails automatically wraps web requests and Active Job workers

So maybe executor and with_connection are irrelevant if used with ActiveJob?

brandonhilkert commented 2 years ago

I'm honestly not sure. I don't use ActiveJob so not sure what it does on its own.

jjb commented 2 years ago

gotcha - I had some discussion about something similar here:

https://github.com/bensheldon/good_job/pull/389#issuecomment-1015990096

i'll close this out for now, may be helpful for people searching in future, or maybe someone more opinionated/knowledgable in future will suggest a change