Repository navigation
Drop the before_fork/on_worker_boot advice - #31241
Conversation
It's no longer required for Active Record, and other common libraries (dalli, redis-rb) all seem to be fork-proof too.
|
Does this mean that if we have existing The Puma repo still recommends the use of these blocks in its documentation:
So there's just a little bit of conflicting information here. But I recognize that Rails 5.2.0 just came out so hopefully documentation will converge and this query will add a bit to that effort. |
Yes. (Assuming they're doing AR connection management, of course.) They're perfectly safe to leave there, so it's not called out in the upgrade guide, but they should no longer be necessary. |
Since Rails 5.2, it is no longer needed. rails/rails#31241 Now the file matches the `rails app:update` more closely.
It's no longer required for Active Record, and other common libraries (dalli, redis-rb) all seem to be fork-proof too.
I was going to drop the more obscure
before_forkbut keepon_worker_boot... but I couldn't come up with a way to describe when it's necessary or what to do, nor a plausible example. (Not because it's hard to describe the problem it fixes, but because the "except for all common libraries" exception makes it sound silly and confusing.)Maybe we can just drop it entirely. If most people don't need it, it seems fine to treat it like any other Puma config option that exists but isn't promoted in the generated file.
Alternatively, does anyone have any other good examples of widely-seen code that apps need in one or both of these? CodeTriage says no; Discourse does a lot, but nothing that strikes me as needing general promotion.
cc @schneems @nateberkopec
(this is follow-on from #31221 and #31173, which remove the need for AR connection management)