From 6f9b7871cdee3a0a55ecee789fcdaf19c981ddfa Mon Sep 17 00:00:00 2001 From: in-void Date: Sun, 12 Mar 2023 12:43:08 +0100 Subject: [PATCH] retry on failure: return last error only --- .../api/browser_extension/app/command/request_2fa_token.go | 3 ++- internal/api/mobile/app/command/send_2fa_token.go | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/internal/api/browser_extension/app/command/request_2fa_token.go b/internal/api/browser_extension/app/command/request_2fa_token.go index 4f09d6b..bcaf8f7 100644 --- a/internal/api/browser_extension/app/command/request_2fa_token.go +++ b/internal/api/browser_extension/app/command/request_2fa_token.go @@ -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(), diff --git a/internal/api/mobile/app/command/send_2fa_token.go b/internal/api/mobile/app/command/send_2fa_token.go index de5081f..d4f2834 100644 --- a/internal/api/mobile/app/command/send_2fa_token.go +++ b/internal/api/mobile/app/command/send_2fa_token.go @@ -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 {