Add Retry method to *RDB

(*RDB).Retry method takes a TaskMessage and will atomically moves the
message from in_progress queue to retry queue. Additionally it
increments the Retried counter and assigns the error message to the
message.
This commit is contained in:
Ken Hibino
2019-12-15 16:15:07 -08:00
parent 1857d12cea
commit 1b1662bb12
4 changed files with 109 additions and 0 deletions

View File

@@ -45,6 +45,14 @@ var sortMsgOpt = cmp.Transformer("SortMsg", func(in []*TaskMessage) []*TaskMessa
return out
})
var sortZSetEntryOpt = cmp.Transformer("SortZSetEntry", func(in []sortedSetEntry) []sortedSetEntry {
out := append([]sortedSetEntry(nil), in...) // Copy input to avoid mutating it
sort.Slice(out, func(i, j int) bool {
return out[i].msg.ID.String() < out[j].msg.ID.String()
})
return out
})
func newTaskMessage(taskType string, payload map[string]interface{}) *TaskMessage {
return &TaskMessage{
ID: xid.New(),