Skip to content

Commit

Permalink
worker status fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
MaYurD :) committed Jun 9, 2019
1 parent 36efc70 commit 1a6444f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```
Expand Down
16 changes: 9 additions & 7 deletions draught/pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
}
}
Expand Down

0 comments on commit 1a6444f

Please sign in to comment.