mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-06 15:57:13 +00:00
Merge pull request #30307 from nodify-at/master
redis-rate-limiter: update version to 1.2.0, provide new options
This commit is contained in:
Vendored
+5
-2
@@ -1,6 +1,7 @@
|
||||
// Type definitions for redis-rate-limiter 1.0.3
|
||||
// Type definitions for redis-rate-limiter 1.2
|
||||
// Project: https://github.com/TabDigital/redis-rate-limiter
|
||||
// Definitions by: Seth Westphal <https://github.com/westy92>
|
||||
// Hasan Oezdemir <https://github.com/nodify-at>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
@@ -20,6 +21,8 @@ declare namespace RedisRateLimiter {
|
||||
window?: number;
|
||||
limit?: number;
|
||||
rate?: string;
|
||||
deleteImmediatelyIfRaceCondition?: boolean;
|
||||
onPossibleRaceCondition?: (key: string) => void;
|
||||
}
|
||||
|
||||
export interface Response {
|
||||
@@ -31,4 +34,4 @@ declare namespace RedisRateLimiter {
|
||||
}
|
||||
}
|
||||
|
||||
export = RedisRateLimiter;
|
||||
export = RedisRateLimiter;
|
||||
|
||||
@@ -30,7 +30,9 @@ limit(request, function(err, rate) {
|
||||
var middleware = rateLimiter.middleware({
|
||||
redis: redisClient,
|
||||
key: 'ip',
|
||||
rate: '100/minute'
|
||||
rate: '100/minute',
|
||||
deleteImmediatelyIfRaceCondition: true,
|
||||
onPossibleRaceCondition: key => console.log(`A race condition has been detected for <${key}>!`)
|
||||
});
|
||||
|
||||
var app = express();
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
"ban-types": false,
|
||||
"callable-types": false,
|
||||
"comment-format": false,
|
||||
"dt-header": false,
|
||||
"eofline": false,
|
||||
"export-just-namespace": false,
|
||||
"import-spacing": false,
|
||||
|
||||
Reference in New Issue
Block a user