summaryrefslogtreecommitdiff
path: root/static_pool.go
diff options
context:
space:
mode:
authorWolfy-J <[email protected]>2018-05-29 13:07:45 +0300
committerWolfy-J <[email protected]>2018-05-29 13:07:45 +0300
commit85b5288c290fd014b76c375fb9ffdf62575e2f2e (patch)
tree6046b584e15c1d515a8944df44399fde9fd77887 /static_pool.go
parentb8bc792b263a3891e125757a35cc563bb85f1a0b (diff)
working on tests
Diffstat (limited to 'static_pool.go')
-rw-r--r--static_pool.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/static_pool.go b/static_pool.go
index 4e75cddc..be5e9b06 100644
--- a/static_pool.go
+++ b/static_pool.go
@@ -170,11 +170,11 @@ func (p *StaticPool) replaceWorker(w *Worker, caused interface{}) {
go p.destroyWorker(w)
if nw, err := p.createWorker(); err != nil {
- p.throw(EventError, WorkerError{Worker: w, Caused: err})
+ p.throw(EventWorkerError, WorkerError{Worker: w, Caused: err})
if len(p.Workers()) == 0 {
// possible situation when major error causes all PHP scripts to die (for example dead DB)
- p.throw(EventError, PoolError("all workers are dead"))
+ p.throw(EventPoolError, fmt.Errorf("all workers are dead"))
}
} else {
p.free <- nw
@@ -183,7 +183,7 @@ func (p *StaticPool) replaceWorker(w *Worker, caused interface{}) {
// destroyWorker destroys workers and removes it from the pool.
func (p *StaticPool) destroyWorker(w *Worker) {
- p.throw(EventDestruct, w)
+ p.throw(EventWorkerDestruct, w)
// detaching
p.muw.Lock()
@@ -203,7 +203,7 @@ func (p *StaticPool) destroyWorker(w *Worker) {
case <-time.NewTimer(p.cfg.DestroyTimeout).C:
// failed to stop process
if err := w.Kill(); err != nil {
- p.throw(EventError, WorkerError{Worker: w, Caused: err})
+ p.throw(EventWorkerError, WorkerError{Worker: w, Caused: err})
}
}
}
@@ -216,11 +216,11 @@ func (p *StaticPool) createWorker() (*Worker, error) {
return nil, err
}
- p.throw(EventCreated, w)
+ p.throw(EventWorkerCreate, w)
go func(w *Worker) {
if err := w.Wait(); err != nil {
- p.throw(EventError, WorkerError{Worker: w, Caused: err})
+ p.throw(EventWorkerError, WorkerError{Worker: w, Caused: err})
}
}(w)