1
0
Fork 0
mirror of https://github.com/puma/puma.git synced 2022-11-09 13:48:40 -05:00

note about on_worker_boot behavior when app is not preloaded (#2778)

* note about on_worker_boot behavior when app is not preloaded

https://github.com/puma/puma/issues/656#issuecomment-999304254

* Prose

Co-authored-by: Nate Berkopec <nate.berkopec@gmail.com>
This commit is contained in:
John Bachir 2022-01-01 20:17:08 +00:00 committed by GitHub
parent 4049759c2d
commit fb59cff9a2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -137,6 +137,11 @@ This code can be used to setup the process before booting the application, allow
you to do some Puma-specific things that you don't want to embed in your application.
For instance, you could fire a log notification that a worker booted or send something to statsd. This can be called multiple times.
Constants loaded by your application (such as `Rails`) will not be available in `on_worker_boot`.
However, these constants _will_ be available if `preload_app!` is enabled, either explicitly in your `puma` config or automatically if
using 2 or more workers in cluster mode.
If `preload_app!` is not enabled and 1 worker is used, then `on_worker_boot` will fire, but your app will not be preloaded and constants will not be available.
`before_fork` specifies a block to be run before workers are forked:
```ruby