Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@genezio/rate-limiter

Package Overview
Dependencies
Maintainers
5
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@genezio/rate-limiter - npm Package Compare versions

Comparing version 1.1.0 to 1.1.1

6

dist/cjs/index.js

@@ -55,3 +55,3 @@ "use strict";

const date = new Date();
const oldCount = await redisClient.get(`${args[0].requestContext.http.sourceIp}:${date.getMinutes()}`);
const oldCount = await redisClient.get(`${args[0].requestContext.http.sourceIp}:${_context.name}:${date.getMinutes()}`);
// If the limit is reached, throw an error

@@ -68,4 +68,4 @@ if (oldCount && parseInt(oldCount) >= (_dict.limit ? _dict.limit : 50)) {

.multi()
.incr(`${args[0].requestContext.http.sourceIp}:${date.getMinutes()}`)
.expire(`${args[0].requestContext.http.sourceIp}:${date.getMinutes()}`, _dict.refreshRate ? _dict.refreshRate : 59)
.incr(`${args[0].requestContext.http.sourceIp}:${_context.name}:${date.getMinutes()}`)
.expire(`${args[0].requestContext.http.sourceIp}:${_context.name}:${date.getMinutes()}`, _dict.refreshRate ? _dict.refreshRate : 59)
.exec();

@@ -72,0 +72,0 @@ }

@@ -55,3 +55,3 @@ "use strict";

const date = new Date();
const oldCount = await redisClient.get(`${args[0].requestContext.http.sourceIp}:${date.getMinutes()}`);
const oldCount = await redisClient.get(`${args[0].requestContext.http.sourceIp}:${_context.name}:${date.getMinutes()}`);
// If the limit is reached, throw an error

@@ -68,4 +68,4 @@ if (oldCount && parseInt(oldCount) >= (_dict.limit ? _dict.limit : 50)) {

.multi()
.incr(`${args[0].requestContext.http.sourceIp}:${date.getMinutes()}`)
.expire(`${args[0].requestContext.http.sourceIp}:${date.getMinutes()}`, _dict.refreshRate ? _dict.refreshRate : 59)
.incr(`${args[0].requestContext.http.sourceIp}:${_context.name}:${date.getMinutes()}`)
.expire(`${args[0].requestContext.http.sourceIp}:${_context.name}:${date.getMinutes()}`, _dict.refreshRate ? _dict.refreshRate : 59)
.exec();

@@ -72,0 +72,0 @@ }

{
"name": "@genezio/rate-limiter",
"version": "1.1.0",
"version": "1.1.1",
"description": "Rate limiter decorator for Genezio applications",

@@ -5,0 +5,0 @@ "main": "./dist/cjs/index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc