ctx bugfix
All checks were successful
/ Make image (push) Successful in 39s

This commit is contained in:
nquidox 2025-12-26 16:36:51 +03:00
parent e48160dfa3
commit 45e633a8d0

View file

@ -34,13 +34,13 @@ func (s *Parser) HandleTasks(tasks []shared.Task, sender chan shared.TaskResult,
}
func (s *Parser) worker(ctx context.Context, receiver chan shared.Task, sender chan shared.TaskResult, state *appState.State) {
pageCtx, pageCancel := chromedp.NewContext(ctx, chromedp.WithLogf(log.Printf))
defer pageCancel()
for task := range receiver {
log.WithField("task_uuid", task.MerchUuid).Debug(logHeader + logWorker + "processing task")
pageCtx, pageCancel := chromedp.NewContext(ctx, chromedp.WithLogf(log.Printf))
price, err := s.getPrice(pageCtx, task)
pageCancel()
if err != nil {
log.WithField("task_uuid", task.MerchUuid).Warn(logHeader + logWorker + logTaskWarning + "failed to process, zero price")
sender <- shared.TaskResult{