Skip to content

Commit 23da92e

Browse files
fix: bucket object key not matching the bucket interface type (#1809)
1 parent ca0e1c0 commit 23da92e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pages/rate-limit/token-bucket.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export class TokenBucketRateLimit<_Key> {
2828
if (bucket === null) {
2929
bucket = {
3030
count: this.max - cost,
31-
refilledAt: now
31+
refilledAtMilliseconds: now
3232
};
3333
this.storage.set(key, bucket);
3434
return true;
@@ -37,7 +37,7 @@ export class TokenBucketRateLimit<_Key> {
3737
(now - bucket.refilledAtMilliseconds) / (this.refillIntervalSeconds * 1000)
3838
);
3939
bucket.count = Math.min(bucket.count + refill, this.max);
40-
bucket.refilledAtSeconds =
40+
bucket.refilledAtMilliseconds =
4141
bucket.refilledAtMilliseconds + refill * this.refillIntervalSeconds * 1000;
4242
if (bucket.count < cost) {
4343
this.storage.set(key, bucket);

0 commit comments

Comments
 (0)