Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

opt: increase the interval of waiting in ReleaseTimeout() #325

Merged
merged 1 commit into from
Jun 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion ants.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion pool_func.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
Loading