Skip to content

Commit 69b60cd

Browse files
docs(settings): state the direction of the period mistake plainly
Greptile read the warning as reversing the effect: it said a window written in seconds is tighter, without saying which side gets tighter. It now says the value is read as 60 ms, the window shrinks a thousandfold, and the limit becomes stricter - the same sentence in the type and in default-settings.yaml.
1 parent 37a398d commit 69b60cd

2 files changed

Lines changed: 12 additions & 7 deletions

File tree

‎resources/default-settings.yaml‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -216,9 +216,13 @@ eventStore:
216216
dvm:
217217
workers: []
218218
limits:
219-
# Every `period` below is in milliseconds. `period: 60` would be a 60 ms
220-
# window and is not rejected, because 60 is a valid count of milliseconds.
221-
# See RateLimit in src/@types/settings.ts.
219+
# Every `period` below is a count of milliseconds. `period: 60`, written as if
220+
# it meant 60 seconds, is read as 60 ms: the window shrinks a thousandfold, so
221+
# the limit becomes a thousand times stricter than the author meant. Nothing
222+
# rejects it, because 60 is a valid count of milliseconds. The unit cannot be
223+
# inferred from the number, so it is stated here and on RateLimit in
224+
# src/@types/settings.ts.
225+
#
222226
# strategy selection configuration for rate limiting:
223227
rateLimiter:
224228
strategy: ewma

‎src/@types/settings.ts‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,11 @@ export interface RateLimit {
2828
* Length of the window in milliseconds.
2929
*
3030
* Every shipped limit counts this way (`1000`, `60000`, `900000`, `3600000`),
31-
* so `period: 60` asks for a 60 ms window: a thousand times tighter than a
32-
* minute, and the relay honours it without complaint. Nothing can tell the
33-
* two apart from the number alone, so the unit is documented where the value
34-
* is set. The validator rejects anything that is not a whole count of
31+
* so `period: 60`, written as if it meant 60 seconds, is read as a 60 ms
32+
* window and makes the limit a thousand times stricter than intended. The
33+
* relay honours it without complaint, and nothing can tell the two apart from
34+
* the number alone, which is why the unit is documented where the value is
35+
* set. The validator rejects anything that is not a whole count of
3536
* milliseconds, at least one.
3637
*/
3738
period: number

0 commit comments

Comments
 (0)