2
0
mirror of https://github.com/hibiken/asynq.git synced 2025-10-26 11:16:12 +08:00

Include worker stats to ProcessState

This commit is contained in:
Ken Hibino
2020-02-20 07:44:13 -08:00
parent 9e02a91808
commit e3c9aae8c7
4 changed files with 192 additions and 22 deletions

View File

@@ -165,10 +165,10 @@ func (p *processor) exec() {
p.requeue(msg)
return
case p.sema <- struct{}{}: // acquire token
p.ps.IncrWorkerCount(1)
p.ps.AddWorkerStats(msg, time.Now())
go func() {
defer func() {
p.ps.IncrWorkerCount(-1)
p.ps.DeleteWorkerStats(msg)
<-p.sema /* release token */
}()