Skip to content

Commit

Permalink
(0.12.0) Significant improvements to Ratelimits
Browse files Browse the repository at this point in the history
- An overhaul of the Ratelimit logic, carefully implementing a sequential queue for buckets, separating the logic of a queue and limits of the queue.
- Adds the previously unfollowed global limit of 50 requests per second by default. This is still bypassed using options.bypassBuckets
- Adds consistency to HTTPMethod casing in route keys and in events emitted
- Add GLOBAL_REQUESTS_PER_SECOND to Constants which can be edited before constructing a SnowTransfer instance
- Export new types/classes
- create message data `poll` is now part of the check for if the message can even be sent as a poll can be sent by itself

Co-Authored-By: Cadence Ember <[email protected]>
Co-Authored-By: viztea <[email protected]>
  • Loading branch information
3 people committed Feb 17, 2025
1 parent 3bdbce9 commit e179497
Show file tree
Hide file tree
Showing 6 changed files with 215 additions and 144 deletions.
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "snowtransfer",
"version": "0.11.0",
"version": "0.12.0",
"description": "Minimalistic Rest client for the Discord Api",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
Expand Down Expand Up @@ -32,13 +32,13 @@
"discord-api-types": "^0.37.119"
},
"devDependencies": {
"@types/node": "^22.13.1",
"@typescript-eslint/eslint-plugin": "^8.23.0",
"@typescript-eslint/parser": "^8.23.0",
"eslint": "^9.20.0",
"@types/node": "^22.13.4",
"@typescript-eslint/eslint-plugin": "^8.24.0",
"@typescript-eslint/parser": "^8.24.0",
"eslint": "^9.20.1",
"tsup": "^8.3.6",
"typedoc": "^0.27.7",
"typedoc-plugin-mdn-links": "^4.0.12",
"typedoc-plugin-mdn-links": "^4.0.13",
"typescript": "^5.7.3"
},
"files": [
Expand Down
1 change: 1 addition & 0 deletions src/Constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const Constants = {
OK_STATUS_CODES: new Set([200, 201, 204, 304]),
DO_NOT_RETRY_STATUS_CODES: new Set([401, 403, 404, 405, 411, 413, 429]),
DEFAULT_RETRY_LIMIT: 3,
GLOBAL_REQUESTS_PER_SECOND: 50,
async standardMultipartHandler(data: { files: Array<{ name: string; file: Buffer | Blob | File | Readable | ReadableStream }>; data?: any; }): Promise<FormData> {
const form = new FormData();

Expand Down
Loading

0 comments on commit e179497

Please sign in to comment.