Skip to content

Commit

Permalink
Merge branch 'release/v0.3.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
Jesús Carrera committed Apr 20, 2015
2 parents 3db2383 + 81a0092 commit 190e41c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tokenbucket",
"version": "0.3.0",
"version": "0.3.1",
"description": "A flexible rate limiter using different variations of the Token Bucket algorithm, with hierarchy support, and optional persistence in Redis. Useful for limiting API requests, or other tasks that need to be throttled.",
"keywords": [
"rate limiter",
Expand Down Expand Up @@ -30,7 +30,7 @@
"coveralls": "gulp coveralls"
},
"dependencies": {
"bluebird": "2.9.14",
"bluebird": "2.9.24",
"redis": "^0.12.1"
},
"devDependencies": {
Expand Down
6 changes: 5 additions & 1 deletion test/tokenbucket.spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ bucket = null
clock = null

# Helper function that checks that the removal happened inmediately or after the supposed time, and that it leaves the right amount of tokens
checkRemoval = ({tokensRemove, time, tokensLeft, done, clock, parentTokensLeft}) ->
checkRemoval = ({tokensRemove, time, tokensLeft, done, clock, parentTokensLeft, nextTickScheduler}) ->
if nextTickScheduler
Promise.setScheduler (fn) ->
process.nextTick fn
bucket.removeTokens(tokensRemove)
.then (remainingTokens) ->
expect(bucket.tokensLeft, 'bucket.tokensLeft').eql tokensLeft if tokensLeft?
Expand Down Expand Up @@ -408,6 +411,7 @@ describe 'a tokenbucket with parent bucket', ->
time: 1000
clock: clock
done: done
nextTickScheduler: true

describe 'when after waiting for the parent doesn\t have enough tokens any more', ->
it 'waits to get enough tokens', (done) ->
Expand Down

0 comments on commit 190e41c

Please sign in to comment.