mirror of https://github.com/panjf2000/ants.git
opt: increase the interval of waiting in ReleaseTimeout() (#325)
This commit is contained in:
parent
ee5a7183d9
commit
0d650f5c1e
5
ants.go
5
ants.go
|
@ -96,7 +96,10 @@ var (
|
|||
defaultAntsPool, _ = NewPool(DefaultAntsPoolSize)
|
||||
)
|
||||
|
||||
const nowTimeUpdateInterval = 500 * time.Millisecond
|
||||
const (
|
||||
nowTimeUpdateInterval = 500 * time.Millisecond
|
||||
releaseTimeoutInterval = 100 * time.Millisecond
|
||||
)
|
||||
|
||||
// Logger is used for logging formatted messages.
|
||||
type Logger interface {
|
||||
|
|
2
pool.go
2
pool.go
|
@ -306,7 +306,7 @@ func (p *Pool) ReleaseTimeout(timeout time.Duration) error {
|
|||
atomic.LoadInt32(&p.ticktockDone) == 1 {
|
||||
return nil
|
||||
}
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
time.Sleep(releaseTimeoutInterval)
|
||||
}
|
||||
return ErrTimeout
|
||||
}
|
||||
|
|
|
@ -311,7 +311,7 @@ func (p *PoolWithFunc) ReleaseTimeout(timeout time.Duration) error {
|
|||
atomic.LoadInt32(&p.ticktockDone) == 1 {
|
||||
return nil
|
||||
}
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
time.Sleep(releaseTimeoutInterval)
|
||||
}
|
||||
return ErrTimeout
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue