Don't add 'getUpdates' request to the queue #44

Merged
laurynas-karvelis merged 1 commits from master into master 2018-04-20 11:32:48 +00:00
Showing only changes of commit abf965c0f2 - Show all commits

View File

@ -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 });