diff options
author | Fabio Berger <me@fabioberger.com> | 2017-06-03 02:49:44 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2017-06-03 02:49:44 +0800 |
commit | 3e115eab4a100eb79ab4bfe4676656e838fb557d (patch) | |
tree | 5879e70e07cd55dc6dab9326d030fe91f2489521 /src | |
parent | 78d7febede6724db16ffa96c9640cc4baa46ebe6 (diff) | |
download | dexon-0x-contracts-3e115eab4a100eb79ab4bfe4676656e838fb557d.tar.gz dexon-0x-contracts-3e115eab4a100eb79ab4bfe4676656e838fb557d.tar.zst dexon-0x-contracts-3e115eab4a100eb79ab4bfe4676656e838fb557d.zip |
Run stopWatching in parallel
Diffstat (limited to 'src')
-rw-r--r-- | src/contract_wrappers/exchange_wrapper.ts | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/contract_wrappers/exchange_wrapper.ts b/src/contract_wrappers/exchange_wrapper.ts index b67fd33ac..ee0b2696f 100644 --- a/src/contract_wrappers/exchange_wrapper.ts +++ b/src/contract_wrappers/exchange_wrapper.ts @@ -199,9 +199,10 @@ export class ExchangeWrapper extends ContractWrapper { this.exchangeLogEventObjs.push(logEventObj); } private async stopWatchingExchangeLogEventsAsync() { - for (const logEventObj of this.exchangeLogEventObjs) { - await promisify(logEventObj.stopWatching, logEventObj)(); - } + const stopWatchingPromises = _.map(this.exchangeLogEventObjs, logEventObj => { + return promisify(logEventObj.stopWatching, logEventObj)(); + }); + await Promise.all(stopWatchingPromises); this.exchangeLogEventObjs = []; } private async validateFillOrderAndThrowIfInvalidAsync(signedOrder: SignedOrder, |