Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
ahnolds committed Dec 19, 2020
1 parent f66fce6 commit 8002448
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
14 changes: 5 additions & 9 deletions src/rest/RequestHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,10 @@ class RequestHandler {

globalDelayFor(ms) {
return new Promise(resolve => {
this.manager.client.setTimeout(
manager => {
manager.globalDelay = null;
resolve();
},
ms,
this.manager,
);
this.manager.client.setTimeout(() => {
this.manager.globalDelay = null;
resolve();
}, ms);
});
}

Expand Down Expand Up @@ -189,7 +185,7 @@ class RequestHandler {
/*
* This is a sublimit (e.g. 2 channel name changes/10 minutes) since the headers don't indicate a
* route-wide rate limit. Don't update remaining or reset to avoid rate limit the whole endpoint,
* just set a reset time on the request itself to avodi retrying too soon.
* just set a reset time on the request itself to avoid retrying too soon.
*/
res.sublimit = retryAfter;
}
Expand Down
2 changes: 1 addition & 1 deletion src/util/Constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const browser = (exports.browser = typeof window !== 'undefined');
* @property {number} [restRequestTimeout=15000] Time to wait before cancelling a REST request, in milliseconds
* @property {number} [restSweepInterval=60] How frequently to delete inactive request buckets, in seconds
* (or 0 for never)
* @property {number} [restGlobalRateLimit=0] How many messages to allow sending per second (0 for unlimited, 50 for
* @property {number} [restGlobalRateLimit=0] How many requests to allow sending per second (0 for unlimited, 50 for
* the standard global limit used by Discord)
* @property {number} [retryLimit=1] How many times to retry on 5XX errors (Infinity for indefinite amount of retries)
* @property {PresenceData} [presence] Presence data to use upon login
Expand Down

0 comments on commit 8002448

Please sign in to comment.