File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -239,19 +239,21 @@ func (p *pool) ready() error {
239
239
p .state = poolReady
240
240
p .stateMu .Unlock ()
241
241
242
- // Signal maintain() to wake up immediately when marking the pool "ready".
243
- select {
244
- case p .maintainReady <- struct {}{}:
245
- default :
246
- }
247
-
242
+ // Send event.PoolReady before resuming the maintain() goroutine to guarantee that the
243
+ // "pool ready" event is always sent before maintain() starts creating connections.
248
244
if p .monitor != nil {
249
245
p .monitor .Event (& event.PoolEvent {
250
246
Type : event .PoolReady ,
251
247
Address : p .address .String (),
252
248
})
253
249
}
254
250
251
+ // Signal maintain() to wake up immediately when marking the pool "ready".
252
+ select {
253
+ case p .maintainReady <- struct {}{}:
254
+ default :
255
+ }
256
+
255
257
return nil
256
258
}
257
259
You can’t perform that action at this time.
0 commit comments