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/contract_wrappers/exchange_wrapper.ts | |
parent | 78d7febede6724db16ffa96c9640cc4baa46ebe6 (diff) | |
download | dexon-sol-tools-3e115eab4a100eb79ab4bfe4676656e838fb557d.tar dexon-sol-tools-3e115eab4a100eb79ab4bfe4676656e838fb557d.tar.gz dexon-sol-tools-3e115eab4a100eb79ab4bfe4676656e838fb557d.tar.bz2 dexon-sol-tools-3e115eab4a100eb79ab4bfe4676656e838fb557d.tar.lz dexon-sol-tools-3e115eab4a100eb79ab4bfe4676656e838fb557d.tar.xz dexon-sol-tools-3e115eab4a100eb79ab4bfe4676656e838fb557d.tar.zst dexon-sol-tools-3e115eab4a100eb79ab4bfe4676656e838fb557d.zip |
Run stopWatching in parallel
Diffstat (limited to 'src/contract_wrappers/exchange_wrapper.ts')
-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, |