From 00e4b4c82a4671e47901bef40775b2149bc5c05c Mon Sep 17 00:00:00 2001 From: Gregory Eremin Date: Wed, 16 Jul 2014 02:53:15 +0700 Subject: [PATCH] Don't try delete records that failed to read --- queue.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/queue.go b/queue.go index c93a5c9..46e1206 100644 --- a/queue.go +++ b/queue.go @@ -34,14 +34,16 @@ func (q *Queue) Fetch() (Message, bool) { msg, err := storage.Get(key) if err != nil { Error(err, "Failed to read record '%s'", key) + return msg, false } err = storage.Remove(key) if err != nil { Error(err, "Failed to delete record '%s'", key) + return msg, false } - return msg, (err == nil) + return msg, true } func GetQueue(name string) *Queue {