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:
parent
4049759c2d
commit
fb59cff9a2
1 changed files with 5 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue