From ff77a182629e473724c712c89116e8f949193bad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20N=C3=A9grier?= Date: Wed, 8 Dec 2021 10:58:53 +0100 Subject: [PATCH] Don't retry Axios if a token decryption failed If a token decryption failed, it will emit a HTTP 500. We should not retry Axios in this case but rather fail. Note: a token decryption failed should not throw a HTTP 500 but another error code (HTTP 401?) So maybe this fix is plainly wrong. --- front/src/Connexion/AxiosUtils.ts | 6 ++++++ messages/protos/messages.proto | 3 +++ 2 files changed, 9 insertions(+) diff --git a/front/src/Connexion/AxiosUtils.ts b/front/src/Connexion/AxiosUtils.ts index 9d50ce4f..f4cd160f 100644 --- a/front/src/Connexion/AxiosUtils.ts +++ b/front/src/Connexion/AxiosUtils.ts @@ -13,6 +13,12 @@ axiosWithRetry.defaults.raxConfig = { maxRetryAfter: 60_000, + statusCodesToRetry: [ + [100, 199], + [429, 429], + [501, 599], + ], + // You can detect when a retry is happening, and figure out how many // retry attempts have been made onRetryAttempt: (err) => { diff --git a/messages/protos/messages.proto b/messages/protos/messages.proto index 5b319feb..7a4d74d9 100644 --- a/messages/protos/messages.proto +++ b/messages/protos/messages.proto @@ -259,6 +259,9 @@ message BanUserMessage{ string message = 2; } +/** + * Messages going from back and pusher to the front + */ message ServerToClientMessage { oneof message { BatchMessage batchMessage = 1;