Skip to content

Commit

Permalink
note about on_worker_boot behavior when app is not preloaded (puma#2778)
Browse files Browse the repository at this point in the history
* note about on_worker_boot behavior when app is not preloaded

puma#656 (comment)

* Prose

Co-authored-by: Nate Berkopec <nate.berkopec@gmail.com>
  • Loading branch information
2 people authored and JuanitoFatas committed Sep 9, 2022
1 parent 1ca8243 commit 4494a75
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions README.md
Expand Up @@ -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
Expand Down

0 comments on commit 4494a75

Please sign in to comment.