context fix
This commit is contained in:
parent
4665c90c2c
commit
c955615fb1
8 changed files with 39 additions and 52 deletions
|
|
@ -1,13 +1,14 @@
|
|||
package processor
|
||||
|
||||
import (
|
||||
"context"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"sync"
|
||||
"task-processor/internal/appState"
|
||||
"task-processor/internal/shared"
|
||||
)
|
||||
|
||||
func (p *Processor) StartWork(receivedTasks []shared.TaskResponse) {
|
||||
func (p *Processor) StartWork(ctx context.Context, receivedTasks []shared.TaskResponse) {
|
||||
log.Info("Starting work...")
|
||||
p.state.ResetCounters()
|
||||
|
||||
|
|
@ -27,7 +28,7 @@ func (p *Processor) StartWork(receivedTasks []shared.TaskResponse) {
|
|||
go func(origin string, tasks []shared.Task) {
|
||||
defer wg.Done()
|
||||
log.Info("Running task handler for origin: ", origin)
|
||||
p.handlers[origin].HandleTasks(tasks, p.out, p.state)
|
||||
p.handlers[origin].HandleTasks(ctx, tasks, p.out, p.state)
|
||||
}(origin, tasks)
|
||||
}
|
||||
wg.Wait()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue