new price parsing methods + tests
All checks were successful
/ Make image (push) Successful in 39s

This commit is contained in:
nquidox 2026-01-05 17:51:02 +03:00
parent ae0a07ae1b
commit 2fa14a7797
3 changed files with 156 additions and 22 deletions

View file

@ -42,17 +42,19 @@ func (s *Parser) worker(ctx context.Context, receiver chan shared.Task, sender c
//price, err := s.getPrice(pageCtx, task)
//pageCancel()
price, err := s.getMinimalPrice(task)
if err != nil {
log.WithField("task_uuid", task.MerchUuid).Warn(logHeader + logWorker + logTaskWarning + "failed to process, zero price")
sender <- shared.TaskResult{
MerchUuid: task.MerchUuid,
Origin: task.Origin,
Price: zeroPrice,
}
continue
}
//price, err := s.getMinimalPrice(task)
//if err != nil {
// log.WithField("task_uuid", task.MerchUuid).Warn(logHeader + logWorker + logTaskWarning + "failed to process, zero price")
// sender <- shared.TaskResult{
// MerchUuid: task.MerchUuid,
// Origin: task.Origin,
// Price: zeroPrice,
// }
// continue
//}
//price will be zeroPrice value in case of any error or if price not found
price := s.getMinimalPrice(task)
sender <- shared.TaskResult{
MerchUuid: task.MerchUuid,
Origin: task.Origin,