summaryrefslogtreecommitdiff
path: root/packages/backend
diff options
context:
space:
mode:
authordakkar <dakkar@thenautilus.net>2024-12-13 15:56:07 +0000
committerdakkar <dakkar@thenautilus.net>2024-12-13 16:18:10 +0000
commit0c1dd73341bdbdb05dfea0b6215fa4e0c3cd7a8b (patch)
treebd27c3026fea1ac8f0855cd90f32b5c9ef464bcd /packages/backend
parentmerge: Add "enable RSS" user privacy toggle (resolves #826) (!806) (diff)
downloadsharkey-0c1dd73341bdbdb05dfea0b6215fa4e0c3cd7a8b.tar.gz
sharkey-0c1dd73341bdbdb05dfea0b6215fa4e0c3cd7a8b.tar.bz2
sharkey-0c1dd73341bdbdb05dfea0b6215fa4e0c3cd7a8b.zip
on 429, retry `fetchAccount` instead of failing
when switching between accounts, with many tabs open (10 seem to be enough), they all hit the endpoint at the same time, and some get rate limited. treating a 429 as a fatal error confuses the frontend, which ends up logging the user out of all their accounts. this code makes the frontend retry, after waiting the appropriate amount of time. seems to work fine in my testing.
Diffstat (limited to 'packages/backend')
-rw-r--r--packages/backend/src/server/api/ApiCallService.ts1
1 files changed, 1 insertions, 0 deletions
diff --git a/packages/backend/src/server/api/ApiCallService.ts b/packages/backend/src/server/api/ApiCallService.ts
index c6c33f7303..974be7e4e1 100644
--- a/packages/backend/src/server/api/ApiCallService.ts
+++ b/packages/backend/src/server/api/ApiCallService.ts
@@ -340,6 +340,7 @@ export class ApiCallService implements OnApplicationShutdown {
code: 'RATE_LIMIT_EXCEEDED',
id: 'd5826d14-3982-4d2e-8011-b9e9f02499ef',
httpStatusCode: 429,
+ info,
});
}
}