From 737dbf7934ef766e70f803ea161ab74517238fce Mon Sep 17 00:00:00 2001 From: Emin Date: Wed, 18 Oct 2023 15:09:21 +0300 Subject: [PATCH] Retry now duplicates the task --- internal/polling.go | 2 -- internal/retry.go | 10 ++++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/polling.go b/internal/polling.go index ccd6db0..0f272a6 100644 --- a/internal/polling.go +++ b/internal/polling.go @@ -12,7 +12,5 @@ func GetPollingData(index int) PageData { Tasks: tasks, } - // addOneTask() - return data } diff --git a/internal/retry.go b/internal/retry.go index 283c5dc..4fcbda2 100644 --- a/internal/retry.go +++ b/internal/retry.go @@ -1,10 +1,12 @@ package internal func RetryTask(task *Task) { - if err := updateTaskStatus(task, "Pending"); err != nil { - log.Errorf("Failed to add task: %s", err) - } + newTask := *task + newTask.Status = "Pending" + newTask.ID = queue.Len() + 1 + queue.PushFront(&newTask) + AddTaskToDB(task) go func() { - taskChan <- *task + taskChan <- newTask }() }