From 797bb4970fced3062c001c4de5842110b535731a Mon Sep 17 00:00:00 2001 From: Brad Rydzewski Date: Thu, 4 May 2017 13:09:51 +0200 Subject: [PATCH] fix issue #2022 --- model/queue.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/model/queue.go b/model/queue.go index 0d827f77..f21642bf 100644 --- a/model/queue.go +++ b/model/queue.go @@ -42,13 +42,14 @@ type persistentQueue struct { // Push pushes an task to the tail of this queue. func (q *persistentQueue) Push(c context.Context, task *queue.Task) error { + q.store.TaskInsert(&Task{ + ID: task.ID, + Data: task.Data, + Labels: task.Labels, + }) err := q.Queue.Push(c, task) - if err == nil { - q.store.TaskInsert(&Task{ - ID: task.ID, - Data: task.Data, - Labels: task.Labels, - }) + if err != nil { + q.store.TaskDelete(task.ID) } return err }