From 5c5bb7c678903afb1f399249c5da33c5b9f0549e Mon Sep 17 00:00:00 2001 From: AustinLeeGordon Date: Fri, 11 Jan 2019 14:50:45 -0600 Subject: [PATCH] Add option to ignore API limit check - Added `checkLimit` option to ignore API limit check --- lib/client.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/client.js b/lib/client.js index 8581b8c..c4508b2 100644 --- a/lib/client.js +++ b/lib/client.js @@ -47,6 +47,8 @@ class Client extends EventEmitter { debug('apiCall', _.pick(params, ['method', 'url'])) this.apiCalls += 1 }) + this.checkLimit = + options.checkLimit !== undefined ? options.checkLimit : true this.broadcasts = new Broadcast(this) this.campaigns = new Campaign(this) @@ -134,6 +136,10 @@ class Client extends EventEmitter { // don't check the api limit for the api call return Promise.resolve() } + if (!this.checkLimit) { + // don't check the api limit for the api call + return Promise.resolve() + } if (this.maxUsePercent === 0) { // if maxUsePercent set to 0, do not check for the API limit (use at your own risk) return Promise.resolve()