Skip to content

Commit 1baab21

Browse files
committed
fix: fix bug in rate limiter
1 parent 8a9fc4c commit 1baab21

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

src/util/rate-limit.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ export const rateLimit = (ms: number) => {
2222
*/
2323
const canRun = () => {
2424
const now = Date.now();
25-
if (now - last >= ms) {
26-
last = now;
25+
if (last === 0 || now - last >= ms) {
2726
return true;
2827
}
2928
return false;

0 commit comments

Comments
 (0)