Commit f7463bb
authored
Ability to optionally drop all connections after fork (#177)
There was a recent feature to automatically drop all connections after fork. This is quite nice
and makes sense.
However, for some rails app that usually follow the fork model (like w/ unicorn/puma), and additionally
have some logic to fork processes to perform internal business logic that doesn't rely or use ConnectionPool,
the application can observe Redis connection issues or resets. These forks can happen during application run time.
Like ours.
In such a case, it'd be nice to not automatically drop all the connections, since the underlying process isn't working
with Redis/ConnectionPool, and as a sideeffect the pool in the primary process is impacted.
This PR proposes a new attribute auto_reload_after_fork as a config option. By default it is true. However, application
users can turn it to false and not opt in for the feature to auto drop connections after fork.
This could be quite useful for us1 parent 3d284f8 commit f7463bb
2 files changed
Lines changed: 19 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| 39 | + | |
39 | 40 | | |
40 | 41 | | |
41 | | - | |
| 42 | + | |
42 | 43 | | |
43 | 44 | | |
44 | 45 | | |
| |||
50 | 51 | | |
51 | 52 | | |
52 | 53 | | |
| 54 | + | |
| 55 | + | |
53 | 56 | | |
54 | 57 | | |
55 | 58 | | |
56 | 59 | | |
57 | | - | |
58 | 60 | | |
59 | 61 | | |
60 | 62 | | |
| |||
92 | 94 | | |
93 | 95 | | |
94 | 96 | | |
| 97 | + | |
95 | 98 | | |
96 | 99 | | |
97 | 100 | | |
| |||
159 | 162 | | |
160 | 163 | | |
161 | 164 | | |
| 165 | + | |
| 166 | + | |
162 | 167 | | |
163 | 168 | | |
164 | 169 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
559 | 559 | | |
560 | 560 | | |
561 | 561 | | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
562 | 574 | | |
563 | 575 | | |
564 | 576 | | |
| |||
0 commit comments