Skip to content

Commit

Permalink
feat: allowfor multiple throttler contexts
Browse files Browse the repository at this point in the history
This is a bit of something that I've wanted to do for a while and inspired by
[this pr][pr]. With the new appraoch, we're now able to let users define scales
at which they would like the throttling to work over, and let it work for any
number of configuratins, from a single 10 requests in 5 seconds to scales of
months, or milliseconds

BREAKING CHANGES:

It's worth noting there are quite a few breaking changes in this which will be
reflected in the changelog as well, but better to have multiple mentions in my
opinion

* ttl is now in milliseconds, not seconds, but there are time helper exposed
to ease the migration to that
* the module options is now either an array or an object with a `throttlers`
array property
* `@Throttle()` now takes in an object instead of two parameters, to allow for
setting multiple throttle contexts at once in a more readable manner
* `@ThrottleSkip()` now takes in an object with string boolean to say which
throttler should be skipped

pr: #1522

ref: #1369
ref: #1522
  • Loading branch information
jmcdo29 committed Sep 4, 2023
1 parent 9847cf4 commit 56d1ccc
Show file tree
Hide file tree
Showing 17 changed files with 923 additions and 210 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
"md5": "^2.2.1"
},
"devDependencies": {
"@apollo/server": "4.9.3",
"@changesets/cli": "2.26.2",
"@commitlint/cli": "17.7.1",
"@commitlint/config-angular": "17.7.0",
Expand All @@ -71,7 +72,6 @@
"@types/supertest": "2.0.12",
"@typescript-eslint/eslint-plugin": "6.6.0",
"@typescript-eslint/parser": "6.6.0",
"@apollo/server": "4.9.3",
"apollo-server-fastify": "3.12.1",
"conventional-changelog-cli": "4.0.0",
"cz-conventional-changelog": "3.3.0",
Expand All @@ -84,6 +84,7 @@
"jest": "29.6.4",
"lint-staged": "14.0.1",
"nodemon": "3.0.1",
"pactum": "^3.4.1",
"pinst": "3.0.0",
"prettier": "3.0.3",
"reflect-metadata": "0.1.13",
Expand Down
Loading

0 comments on commit 56d1ccc

Please sign in to comment.