alik0211 / mtproto-core

Telegram API JS (MTProto) client library for Node.js and browser
https://mtproto-core.js.org
GNU General Public License v3.0
625 stars 111 forks source link

Why you use timeout in code example? #253

Open psqq opened 2 years ago

psqq commented 2 years ago

I found an example here https://mtproto-core.js.org/docs/setup-handle-errors

      if (error_code === 420) {
        const seconds = Number(error_message.split('FLOOD_WAIT_')[1]);
        const ms = seconds * 1000;

        await sleep(ms);

        return this.call(method, params, options);
      }

Is it really a good idea for any api calls? The number of seconds can be more than 20 hours.