Don't try delete records that failed to read
This commit is contained in:
parent
dadbcfd0f1
commit
00e4b4c82a
4
queue.go
4
queue.go
@ -34,14 +34,16 @@ func (q *Queue) Fetch() (Message, bool) {
|
|||||||
msg, err := storage.Get(key)
|
msg, err := storage.Get(key)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
Error(err, "Failed to read record '%s'", key)
|
Error(err, "Failed to read record '%s'", key)
|
||||||
|
return msg, false
|
||||||
}
|
}
|
||||||
|
|
||||||
err = storage.Remove(key)
|
err = storage.Remove(key)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
Error(err, "Failed to delete record '%s'", key)
|
Error(err, "Failed to delete record '%s'", key)
|
||||||
|
return msg, false
|
||||||
}
|
}
|
||||||
|
|
||||||
return msg, (err == nil)
|
return msg, true
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetQueue(name string) *Queue {
|
func GetQueue(name string) *Queue {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user