@thirdweb-dev/service-utils 0.9.0 → 0.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -42,7 +42,7 @@ async function rateLimit(args) {
|
|
42
42
|
// do not await this, it just needs to execute at all
|
43
43
|
(async () =>
|
44
44
|
// always incrementBy the amount specified for the key
|
45
|
-
await redis.
|
45
|
+
await redis.incrby(key, increment).then(async () => {
|
46
46
|
// if the initial request count was 0, set the key to expire in the future
|
47
47
|
if (requestCount === 0) {
|
48
48
|
await redis.expire(key, RATE_LIMIT_WINDOW_SECONDS);
|
@@ -39,7 +39,7 @@ export async function rateLimit(args) {
|
|
39
39
|
// do not await this, it just needs to execute at all
|
40
40
|
(async () =>
|
41
41
|
// always incrementBy the amount specified for the key
|
42
|
-
await redis.
|
42
|
+
await redis.incrby(key, increment).then(async () => {
|
43
43
|
// if the initial request count was 0, set the key to expire in the future
|
44
44
|
if (requestCount === 0) {
|
45
45
|
await redis.expire(key, RATE_LIMIT_WINDOW_SECONDS);
|
@@ -3,7 +3,7 @@ import type { RateLimitResult } from "./types.js";
|
|
3
3
|
type IRedis = {
|
4
4
|
get: (key: string) => Promise<string | null>;
|
5
5
|
expire(key: string, seconds: number): Promise<number>;
|
6
|
-
|
6
|
+
incrby(key: string, value: number): Promise<number>;
|
7
7
|
};
|
8
8
|
export declare function rateLimit(args: {
|
9
9
|
team: TeamResponse;
|