File tree 3 files changed +6
-4
lines changed
3 files changed +6
-4
lines changed Original file line number Diff line number Diff line change 97
97
)
98
98
99
99
const (
100
- nowTimeUpdateInterval = 500 * time .Millisecond
101
- releaseTimeoutInterval = 100 * time . Millisecond
100
+ nowTimeUpdateInterval = 500 * time .Millisecond
101
+ releaseTimeoutCount = 10
102
102
)
103
103
104
104
// Logger is used for logging formatted messages.
Original file line number Diff line number Diff line change @@ -299,14 +299,15 @@ func (p *Pool) ReleaseTimeout(timeout time.Duration) error {
299
299
}
300
300
p .Release ()
301
301
302
+ interval := timeout / releaseTimeoutCount
302
303
endTime := time .Now ().Add (timeout )
303
304
for time .Now ().Before (endTime ) {
304
305
if p .Running () == 0 &&
305
306
(p .options .DisablePurge || atomic .LoadInt32 (& p .purgeDone ) == 1 ) &&
306
307
atomic .LoadInt32 (& p .ticktockDone ) == 1 {
307
308
return nil
308
309
}
309
- time .Sleep (releaseTimeoutInterval )
310
+ time .Sleep (interval )
310
311
}
311
312
return ErrTimeout
312
313
}
Original file line number Diff line number Diff line change @@ -304,14 +304,15 @@ func (p *PoolWithFunc) ReleaseTimeout(timeout time.Duration) error {
304
304
}
305
305
p .Release ()
306
306
307
+ interval := timeout / releaseTimeoutCount
307
308
endTime := time .Now ().Add (timeout )
308
309
for time .Now ().Before (endTime ) {
309
310
if p .Running () == 0 &&
310
311
(p .options .DisablePurge || atomic .LoadInt32 (& p .purgeDone ) == 1 ) &&
311
312
atomic .LoadInt32 (& p .ticktockDone ) == 1 {
312
313
return nil
313
314
}
314
- time .Sleep (releaseTimeoutInterval )
315
+ time .Sleep (interval )
315
316
}
316
317
return ErrTimeout
317
318
}
You can’t perform that action at this time.
0 commit comments