retry on failure: return last error only

This commit is contained in:
in-void 2023-03-12 12:43:08 +01:00
parent fc82335cbd
commit 6f9b7871cd
2 changed files with 3 additions and 1 deletions

View File

@ -100,9 +100,10 @@ func (h *Request2FaTokenHandler) Handle(cmd *Request2FaToken) error {
return h.Pusher.Send(context.Background(), notification)
},
retry.Attempts(5),
retry.LastErrorOnly(true),
)
if err != nil && !messaging.IsRegistrationTokenNotRegistered(err) {
if err != nil && !messaging.IsUnregistered(err) {
logging.WithFields(logging.Fields{
"extension_id": extId.String(),
"device_id": device.Id.String(),

View File

@ -66,6 +66,7 @@ func (h *Send2FaTokenHandler) Handle(cmd *Send2FaToken) error {
return h.WebsocketClient.SendMessage(uri, message)
},
retry.Attempts(5),
retry.LastErrorOnly(true),
)
if err != nil {