summaryrefslogtreecommitdiff
path: root/static_pool.go
diff options
context:
space:
mode:
authorWolfy-J <[email protected]>2019-12-23 14:43:47 +0300
committerWolfy-J <[email protected]>2019-12-23 14:43:47 +0300
commitc7b0a4a81827284f7565c56aa476eea34fb6382f (patch)
treeee30e93169c37fb058fbe55af6b3f954eabd9646 /static_pool.go
parent7f694966730f6dac09d0d0ea3bf51276b8e4dfe4 (diff)
- test fixes
Diffstat (limited to 'static_pool.go')
-rw-r--r--static_pool.go12
1 files changed, 7 insertions, 5 deletions
diff --git a/static_pool.go b/static_pool.go
index 66b1366e..2186227b 100644
--- a/static_pool.go
+++ b/static_pool.go
@@ -42,7 +42,6 @@ type StaticPool struct {
workers []*Worker
// invalid declares set of workers to be removed from the pool.
- mur sync.Mutex
remove sync.Map
// pool is being destroyed
@@ -108,9 +107,7 @@ func (p *StaticPool) Workers() (workers []*Worker) {
p.muw.RLock()
defer p.muw.RUnlock()
- for _, w := range p.workers {
- workers = append(workers, w)
- }
+ workers = append(workers, p.workers...)
return workers
}
@@ -294,7 +291,12 @@ func (p *StaticPool) discardWorker(w *Worker, caused interface{}) {
// destroyWorker destroys workers and removes it from the pool.
func (p *StaticPool) destroyWorker(w *Worker, caused interface{}) {
- go w.Stop()
+ go func() {
+ err := w.Stop()
+ if err != nil {
+ p.throw(EventWorkerError, WorkerError{Worker: w, Caused: err})
+ }
+ }()
select {
case <-w.waitDone: