leaky-bucket
Advanced tools
Comparing version 0.1.6 to 0.1.7
{ | ||
"name" : "leaky-bucket" | ||
, "description" : "A fast and efficient leaky bucket implementation" | ||
, "version" : "0.1.6" | ||
, "version" : "0.1.7" | ||
, "homepage" : "https://github.com/eventEmitter/leaky-bucket" | ||
@@ -6,0 +6,0 @@ , "author" : "Michael van der Weg <michael@joinbox.com> (http://joinbox.com/)" |
@@ -25,3 +25,3 @@ # leaky-bucket | ||
var instance = new LeakyBucket([RequestsPerInterval = 60][, Interval = 60]); | ||
var instance = new LeakyBucket([ItemsPerInterval = 60][, Interval = 60]); | ||
@@ -34,3 +34,3 @@ | ||
Create a new leaky bucket which is allowed to execute 120 items every 30 seconds | ||
Create a new leaky bucket which is allowed to execute 200 items every 30 seconds | ||
@@ -75,9 +75,15 @@ var bucket = new LeakyBucket(200, 30); | ||
var bucket = new LeakyBucket(60); | ||
var LeakyBucket = require('leaky-bucket') | ||
, request = require('request') | ||
, bucket; | ||
// create bucket instance, 60 request per minute | ||
bucket = new LeakyBucket(60); | ||
// this will throttle request if required | ||
bucket.throttle(function() { | ||
// execute request | ||
// execute request using the request module | ||
request({ | ||
@@ -84,0 +90,0 @@ method: 'get' |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12755
92