Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added a method to get the number of remaining tokens

  • Loading branch information...
commit e5c12c7a10e94741c73575f0d56558095991b620 1 parent dead952
@luto luto authored
Showing with 8 additions and 0 deletions.
  1. +8 −0 lib/rateLimiter.js
View
8 lib/rateLimiter.js
@@ -84,6 +84,14 @@ RateLimiter.prototype = {
self.tokensThisInterval += count;
callback(null, tokensRemaining);
}
+ },
+
+ /**
+ * Returns the number of tokens remaining in the TokenBucket.
+ * @returns {Number} The number of tokens remaining.
+ */
+ getTokensRemaining: function () {
+ return this.tokenBucket.content;
}
};
Please sign in to comment.
Something went wrong with that request. Please try again.