diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-11-23 02:15:31 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-11-24 05:13:36 +0800 |
commit | 66aaceea915b6412c8ff8bcb5001363da8aaca39 (patch) | |
tree | a636673a2fef8a6db85918e1b391fe75e3fb0a1d /packages/0x.js/src/order_watcher/expiration_watcher.ts | |
parent | 4fe28ec53c4e84544c3c21853dff57c4c6a4e45d (diff) | |
download | dexon-sol-tools-66aaceea915b6412c8ff8bcb5001363da8aaca39.tar dexon-sol-tools-66aaceea915b6412c8ff8bcb5001363da8aaca39.tar.gz dexon-sol-tools-66aaceea915b6412c8ff8bcb5001363da8aaca39.tar.bz2 dexon-sol-tools-66aaceea915b6412c8ff8bcb5001363da8aaca39.tar.lz dexon-sol-tools-66aaceea915b6412c8ff8bcb5001363da8aaca39.tar.xz dexon-sol-tools-66aaceea915b6412c8ff8bcb5001363da8aaca39.tar.zst dexon-sol-tools-66aaceea915b6412c8ff8bcb5001363da8aaca39.zip |
Cleanup order watcher from redundant asyncs
Diffstat (limited to 'packages/0x.js/src/order_watcher/expiration_watcher.ts')
-rw-r--r-- | packages/0x.js/src/order_watcher/expiration_watcher.ts | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/packages/0x.js/src/order_watcher/expiration_watcher.ts b/packages/0x.js/src/order_watcher/expiration_watcher.ts index 717edaad7..2ea7835d9 100644 --- a/packages/0x.js/src/order_watcher/expiration_watcher.ts +++ b/packages/0x.js/src/order_watcher/expiration_watcher.ts @@ -29,12 +29,12 @@ export class ExpirationWatcher { const comparator = (lhs: string, rhs: string) => scoreFunction(lhs) - scoreFunction(rhs); this.orderHashByExpirationRBTree = new RBTree(comparator); } - public subscribe(callbackAsync: (orderHash: string) => Promise<void>): void { + public subscribe(callback: (orderHash: string) => void): void { if (!_.isUndefined(this.orderExpirationCheckingIntervalIdIfExists)) { throw new Error(ZeroExError.SubscriptionAlreadyPresent); } this.orderExpirationCheckingIntervalIdIfExists = intervalUtils.setAsyncExcludingInterval( - this.pruneExpiredOrdersAsync.bind(this, callbackAsync), this.orderExpirationCheckingIntervalMs, + this.pruneExpiredOrders.bind(this, callback), this.orderExpirationCheckingIntervalMs, ); } public unsubscribe(): void { @@ -52,7 +52,7 @@ export class ExpirationWatcher { this.orderHashByExpirationRBTree.remove(orderHash); delete this.expiration[orderHash]; } - private async pruneExpiredOrdersAsync(callbackAsync: (orderHash: string) => Promise<void>): Promise<void> { + private pruneExpiredOrders(callback: (orderHash: string) => void): void { const currentUnixTimestampMs = utils.getCurrentUnixTimestampMs(); while (true) { const hasTrakedOrders = this.orderHashByExpirationRBTree.size === 0; @@ -70,7 +70,7 @@ export class ExpirationWatcher { const orderHash = this.orderHashByExpirationRBTree.min(); this.orderHashByExpirationRBTree.remove(orderHash); delete this.expiration[orderHash]; - await callbackAsync(orderHash); + callback(orderHash); } } } |