From abf965c0f20fdcba0dec31193217e165634bba95 Mon Sep 17 00:00:00 2001 From: Laurynas Karvelis Date: Fri, 20 Apr 2018 13:36:48 +0300 Subject: [PATCH] Don't add 'getUpdates' request to the queue as it's going to hinder 'send*' calls performance --- src/functions/api.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/functions/api.js b/src/functions/api.js index 9ee952d..4ca5ee4 100644 --- a/src/functions/api.js +++ b/src/functions/api.js @@ -65,6 +65,11 @@ const methods = ['getMe', 'sendMessage', 'forwardMessage', 'sendPhoto', methods.forEach(method => { API.prototype[method] = function (data) { //eslint-disable-line + if (method === 'getUpdates') { + // don't add 'getUpdates' request to the queue as it's going to hinder 'send*' calls performance + return this.request(method, data); + } + // implementation taken from https://github.com/yagop/node-telegram-bot-api/issues/192#issuecomment-249488807 return new Promise((resolve, reject) => { this._queue.push({ method, data, resolve, reject });