@upstash/ratelimit
Advanced tools
Comparing version
@@ -227,3 +227,3 @@ "use strict"; | ||
this.limiter = config.limiter; | ||
this.timeout = config.timeout; | ||
this.timeout = config.timeout ?? 5e3; | ||
this.prefix = config.prefix ?? "@upstash/ratelimit"; | ||
@@ -245,3 +245,3 @@ this.analytics = config.analytics !== false ? new Analytics({ | ||
const arr = [this.limiter(this.ctx, key)]; | ||
if (this.timeout) { | ||
if (this.timeout > 0) { | ||
arr.push( | ||
@@ -248,0 +248,0 @@ new Promise((resolve) => { |
@@ -174,2 +174,4 @@ import { Redis } from '@upstash/redis'; | ||
* Use this if you want to allow requests in case of network problems | ||
* | ||
* @default 5000 | ||
*/ | ||
@@ -204,3 +206,3 @@ timeout?: number; | ||
protected readonly prefix: string; | ||
protected readonly timeout?: number; | ||
protected readonly timeout: number; | ||
protected readonly analytics?: Analytics; | ||
@@ -207,0 +209,0 @@ constructor(config: RatelimitConfig<TContext>); |
@@ -227,3 +227,3 @@ "use strict"; | ||
this.limiter = config.limiter; | ||
this.timeout = config.timeout; | ||
this.timeout = config.timeout ?? 5e3; | ||
this.prefix = config.prefix ?? "@upstash/ratelimit"; | ||
@@ -245,3 +245,3 @@ this.analytics = config.analytics !== false ? new Analytics({ | ||
const arr = [this.limiter(this.ctx, key)]; | ||
if (this.timeout) { | ||
if (this.timeout > 0) { | ||
arr.push( | ||
@@ -248,0 +248,0 @@ new Promise((resolve) => { |
{ | ||
"name": "@upstash/ratelimit", | ||
"version": "0.3.1", | ||
"version": "0.3.2", | ||
"main": "./dist/index.js", | ||
@@ -5,0 +5,0 @@ "types": "./dist/index.d.ts", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
209646
0.07%2649
0.08%0
-100%