From 9c69e2a5e13ded57fc2ea6817a6a28740526ea1c Mon Sep 17 00:00:00 2001 From: Brad Rydzewski Date: Thu, 4 May 2017 03:14:48 +0200 Subject: [PATCH] add debug info to queue backup --- model/queue.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/model/queue.go b/model/queue.go index 0b527d61..0d827f77 100644 --- a/model/queue.go +++ b/model/queue.go @@ -3,6 +3,7 @@ package model import ( "context" + "github.com/Sirupsen/logrus" "github.com/cncd/queue" ) @@ -55,8 +56,13 @@ func (q *persistentQueue) Push(c context.Context, task *queue.Task) error { // Poll retrieves and removes a task head of this queue. func (q *persistentQueue) Poll(c context.Context, f queue.Filter) (*queue.Task, error) { task, err := q.Queue.Poll(c, f) - if err == nil { - q.store.TaskDelete(task.ID) + if task != nil { + logrus.Debugf("pull queue item: %s: remove from backup", task.ID) + if derr := q.store.TaskDelete(task.ID); derr != nil { + logrus.Errorf("pull queue item: %s: failed to remove from backup: %s", task.ID, derr) + } else { + logrus.Errorf("pull queue item: %s: successfully removed from backup", task.ID) + } } return task, err }