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

async-ratelimiter

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

async-ratelimiter - npm Package Compare versions

Comparing version 1.1.1 to 1.1.2

8

CHANGELOG.md

@@ -0,1 +1,9 @@

<a name="1.1.2"></a>
## 1.1.2 (2018-07-23)
* Closes #6 ([6614d30](https://github.com/microlinkhq/async-ratelimiter/commit/6614d30)), closes [#6](https://github.com/microlinkhq/async-ratelimiter/issues/6)
* old data test and delete the old ones by score ([31beaed](https://github.com/microlinkhq/async-ratelimiter/commit/31beaed))
<a name="1.1.1"></a>

@@ -2,0 +10,0 @@ ## 1.1.1 (2018-07-18)

10

package.json

@@ -5,3 +5,3 @@ {

"homepage": "https://documentup.com/microlinkhq/async-ratelimiter",
"version": "1.1.1",
"version": "1.1.2",
"main": "src/index.js",

@@ -15,2 +15,6 @@ "author": {

{
"name": "TJ Holowaychuk",
"email": "tj@vision-media.ca"
},
{
"name": "Noam Shemesh",

@@ -20,6 +24,2 @@ "email": "noam@bigpanda.io"

{
"name": "TJ Holowaychuk",
"email": "tj@vision-media.ca"
},
{
"name": "Kiko Beats",

@@ -26,0 +26,0 @@ "email": "josefrancisco.verdu@gmail.com"

@@ -29,6 +29,7 @@ 'use strict'

.multi()
.zrange([key, 0, start, 'WITHSCORES'])
.zremrangebyscore([key, 0, start])
.zcard([key])
.zadd([key, now, now])
.zrange([key, 0, 0])
.zrange([key, -max, -max])
.pexpire([key, duration])

@@ -39,6 +40,9 @@ .exec()

const oldest = parseInt(res[3][1])
const oldestInRange = parseInt(res[4][1])
const resetMicro =
(Number.isNaN(oldestInRange) ? oldest : oldestInRange) + duration * 1000
return {
remaining: count < max ? max - count : 0,
reset: Math.floor((oldest + duration * 1000) / 1000000),
reset: Math.floor(resetMicro / 1000000),
total: max

@@ -45,0 +49,0 @@ }

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