diff --git a/README.md b/README.md index da565e7..7ad59a4 100644 --- a/README.md +++ b/README.md @@ -200,7 +200,9 @@ To log pool status after every specified batch of jobs complition. ##### Time profiler ``` pool.SetTimeProfiler(500 * time.Millisecond) -To log pool status after every specified time. +To log pool status after every specified time. +If the pool worker got stuck at same process for more than +thrice of the profiler time then it will log the worker current status. ``` #### Profiler Example ``` diff --git a/draught/pool.go b/draught/pool.go index 8369a37..d68263b 100644 --- a/draught/pool.go +++ b/draught/pool.go @@ -162,13 +162,15 @@ func (p *Pool) workerStatus() { } for _, w := range p.workerPool { - msg = fmt.Sprintf("Value %v Error %v\n", - w.job.GetValue(), w.job.GetError()) - if p.consoleLog { - d = color.New(color.FgBlack) - d.Print(msg) - } else { - log.Print(msg) + if w.working { + msg = fmt.Sprintf("Value %v Error %v\n", + w.job.GetValue(), w.job.GetError()) + if p.consoleLog { + d = color.New(color.FgBlack) + d.Print(msg) + } else { + log.Print(msg) + } } } }