From 470399f9de74770563064cd7bff7f014ead88c94 Mon Sep 17 00:00:00 2001 From: Jeeva Kandasamy Date: Sun, 18 Jun 2023 22:50:13 +0530 Subject: [PATCH] requeue implementation Signed-off-by: Jeeva Kandasamy --- pkg/service/handler/message_listerner.go | 3 +++ plugin/handler/types/handler.go | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/pkg/service/handler/message_listerner.go b/pkg/service/handler/message_listerner.go index 4b2e7db..34b4d41 100644 --- a/pkg/service/handler/message_listerner.go +++ b/pkg/service/handler/message_listerner.go @@ -63,6 +63,9 @@ func (svc *HandlerService) processHandlerMessage(item interface{}) { err := handler.Post(msg.Data) if err != nil { + if err == handlerTY.ErrReQueue { + // TODO: requeue and try again + } svc.logger.Warn("error from handler", zap.Any("handlerID", msg.ID), zap.Error(err)) state.Status = types.StatusError state.Message = err.Error() diff --git a/plugin/handler/types/handler.go b/plugin/handler/types/handler.go index 02fe128..dcb8de0 100644 --- a/plugin/handler/types/handler.go +++ b/plugin/handler/types/handler.go @@ -1,6 +1,7 @@ package handler import ( + "errors" "strings" "time" @@ -17,6 +18,10 @@ const ( DataTypeBackup = "backup" ) +var ( + ErrReQueue = errors.New("requeue") +) + // Plugin interface details for operation type Plugin interface { Name() string