@@ -34,11 +34,7 @@ class ConnectionPool {
34
34
this . _ssl = opts . ssl
35
35
this . _agent = opts . agent
36
36
// the resurrect timeout is 60s
37
- // we multiply it by 2 because the resurrect formula is
38
- // `Math.pow(resurrectTimeout * 2, deadCount -1)`
39
- // and we don't need to multiply by 2
40
- // the resurrectTimeout every time
41
- this . resurrectTimeout = 1000 * 60 * 2
37
+ this . resurrectTimeout = 1000 * 60
42
38
// number of consecutive failures after which
43
39
// the timeout doesn't increase
44
40
this . resurrectTimeoutCutoff = 5
@@ -94,15 +90,9 @@ class ConnectionPool {
94
90
connection . status = Connection . statuses . DEAD
95
91
connection . deadCount ++
96
92
// resurrectTimeout formula:
97
- // `Math.pow(resurrectTimeout * 2, deadCount -1)`
98
- // we don't need to multiply the resurrectTimeout by 2
99
- // every time, it is cached during the initialization
100
- connection . resurrectTimeout = Date . now ( ) + Math . pow (
101
- this . resurrectTimeout ,
102
- Math . min (
103
- connection . deadCount - 1 ,
104
- this . resurrectTimeoutCutoff
105
- )
93
+ // `resurrectTimeout * 2 ** min(deadCount - 1, resurrectTimeoutCutoff)`
94
+ connection . resurrectTimeout = Date . now ( ) + this . resurrectTimeout * Math . pow (
95
+ 2 , Math . min ( connection . deadCount - 1 , this . resurrectTimeoutCutoff )
106
96
)
107
97
108
98
// sort the dead list in ascending order
0 commit comments