Revert "fix Client.destroy bugs" (#839)

This commit is contained in:
Amish Shah
2016-10-26 17:30:18 +01:00
committed by GitHub
parent 18e9850e1e
commit 7d04863b66
4 changed files with 20 additions and 26 deletions

View File

@@ -234,14 +234,17 @@ class Client extends EventEmitter {
* @returns {Promise}
*/
destroy() {
return this.manager.destroy().then(() => {
for (const t of this._timeouts) clearTimeout(t);
for (const i of this._intervals) clearInterval(i);
this._timeouts.clear();
this._intervals.clear();
this.token = null;
this.email = null;
this.password = null;
return new Promise((resolve, reject) => {
this.manager.destroy().then(() => {
for (const t of this._timeouts) clearTimeout(t);
for (const i of this._intervals) clearInterval(i);
this._timeouts = [];
this._intervals = [];
this.token = null;
this.email = null;
this.password = null;
resolve();
}).catch(reject);
});
}