feat: abort Requests that takes a lot of time to resolve (#3327)

* Add Request Timeout

* Add abort controller in packages

* Fix Lint Error.

* Fix Lint Errors

* Make Timeout Customizable & use finally

* Fixed a minor issue

* Fix eslint

* Update request timeout to use d.js client timeout methods.
This commit is contained in:
Saya
2019-08-20 00:55:07 +08:00
committed by SpaceEEC
parent 3fcc862c5f
commit e4309b23d5
5 changed files with 12 additions and 1 deletions

View File

@@ -28,6 +28,7 @@ const browser = exports.browser = typeof window !== 'undefined';
* corresponding websocket events
* @property {number} [restTimeOffset=500] Extra time in millseconds to wait before continuing to make REST
* requests (higher values will reduce rate-limiting errors on bad connections)
* @property {number} [restRequestTimeout=15000] Time to wait before cancelling a REST request
* @property {number} [restSweepInterval=60] How frequently to delete inactive request buckets, in seconds
* (or 0 for never)
* @property {number} [retryLimit=1] How many times to retry on 5XX errors (Infinity for indefinite amount of retries)
@@ -50,6 +51,7 @@ exports.DefaultOptions = {
partials: [],
restWsBridgeTimeout: 5000,
disabledEvents: [],
restRequestTimeout: 15000,
retryLimit: 1,
restTimeOffset: 500,
restSweepInterval: 60,