context fix

This commit is contained in:
nquidox 2026-02-28 10:53:02 +03:00
parent 4665c90c2c
commit c955615fb1
8 changed files with 39 additions and 52 deletions

View file

@ -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()