Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/disbox-file-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,11 @@ class DiscordWebhookClient {
this.rateLimitWaits[type] = (retryAfter) * 1000;
console.log("Rate limit exceeded, retrying");
return await this.fetchFromApi(path, {method, body, type});
}
if (status >= 400) {
} else if (status === 502) {
this.rateLimitWaits[type] = 10 * 1000;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The wait seconds should probably be in a const.

console.log("Gateway unavailable, retrying");
return await this.fetchFromApi(path, {method, body, type});
} else if (status >= 400) {
throw new Error(`Failed to ${type} with status ${status}: ${await response.text()}`);
}
return response;
Expand Down