Use intervalUtils.clearAsyncExcludingInterval instead of calling clearInterval directly for grepability

This commit is contained in:
Fabio Berger
2018-01-18 19:29:54 +08:00
parent 807d9e3eef
commit f9c21efc30
2 changed files with 4 additions and 4 deletions

View File

@@ -372,12 +372,12 @@ export class Blockchain {
const [balance] = await this.getTokenBalanceAndAllowanceAsync(this._userAddress, token.address);
if (!balance.eq(currBalance)) {
this._dispatcher.replaceTokenBalanceByAddress(token.address, balance);
clearInterval(this._zrxPollIntervalId);
intervalUtils.clearAsyncExcludingInterval(this._zrxPollIntervalId);
delete this._zrxPollIntervalId;
}
}, 5000, (err: Error) => {
utils.consoleLog(`Polling tokenBalance failed: ${err}`);
clearInterval(this._zrxPollIntervalId);
intervalUtils.clearAsyncExcludingInterval(this._zrxPollIntervalId);
delete this._zrxPollIntervalId;
});
}
@@ -475,7 +475,7 @@ export class Blockchain {
this._web3Wrapper.updatePrevUserAddress(newUserAddress);
}
public destroy() {
clearInterval(this._zrxPollIntervalId);
intervalUtils.clearAsyncExcludingInterval(this._zrxPollIntervalId);
this._web3Wrapper.destroy();
this._stopWatchingExchangeLogFillEvents();
}

View File

@@ -149,6 +149,6 @@ export class Web3Wrapper {
}
}
private _stopEmittingNetworkConnectionAndUserBalanceStateAsync() {
clearInterval(this._watchNetworkAndBalanceIntervalId);
intervalUtils.clearAsyncExcludingInterval(this._watchNetworkAndBalanceIntervalId);
}
}