This commit is contained in:
parent
e48160dfa3
commit
45e633a8d0
1 changed files with 3 additions and 3 deletions
|
|
@ -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) {
|
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 {
|
for task := range receiver {
|
||||||
log.WithField("task_uuid", task.MerchUuid).Debug(logHeader + logWorker + "processing task")
|
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)
|
price, err := s.getPrice(pageCtx, task)
|
||||||
|
pageCancel()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.WithField("task_uuid", task.MerchUuid).Warn(logHeader + logWorker + logTaskWarning + "failed to process, zero price")
|
log.WithField("task_uuid", task.MerchUuid).Warn(logHeader + logWorker + logTaskWarning + "failed to process, zero price")
|
||||||
sender <- shared.TaskResult{
|
sender <- shared.TaskResult{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue