You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, when calling pool.Stop(), there's no immediate way to know when the pool has completely halted its operations.
By adding a chan struct{} return type to pool.Stop(), users can receive a signal indicating when the pool has stopped, enabling better management of resources and cleanup tasks.
This enhancement would help when multiple concurrent cleanup tasks need to be executed within a predefined timeframe.
ctx, cancel:=context.WithTimeout(context.Background(), 5*time.Second)
defercancel()
poolStopped:=pool.Stop()
otherStopped:=other.Stop()
select {
case<-poolStopped:
case<-ctx.Done():
log.Error("Worker pool did not stop gracefully")
}
select {
case<-otherStopped:
case<-ctx.Done():
log.Error("other did not stop gracefully")
}
Let me know if you think that would be a good addition, and if so, I can create a pull request for it.
The text was updated successfully, but these errors were encountered:
Currently, when calling pool.Stop(), there's no immediate way to know when the pool has completely halted its operations.
By adding a chan struct{} return type to pool.Stop(), users can receive a signal indicating when the pool has stopped, enabling better management of resources and cleanup tasks.
This enhancement would help when multiple concurrent cleanup tasks need to be executed within a predefined timeframe.
Let me know if you think that would be a good addition, and if so, I can create a pull request for it.
The text was updated successfully, but these errors were encountered: