From cbca2061f7f0e2632d5c74be62328d9e49dd822e Mon Sep 17 00:00:00 2001 From: Ara Kevonian Date: Tue, 17 Apr 2018 07:25:13 -0700 Subject: Fix redundant expired order removal bug --- packages/0x.js/src/order_watcher/order_state_watcher.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'packages/0x.js/src') diff --git a/packages/0x.js/src/order_watcher/order_state_watcher.ts b/packages/0x.js/src/order_watcher/order_state_watcher.ts index a9df8ac9d..94b463921 100644 --- a/packages/0x.js/src/order_watcher/order_state_watcher.ts +++ b/packages/0x.js/src/order_watcher/order_state_watcher.ts @@ -123,7 +123,7 @@ export class OrderStateWatcher { * Removes an order from the orderStateWatcher * @param orderHash The orderHash of the order you wish to stop watching. */ - public removeOrder(orderHash: string): void { + public removeOrder(orderHash: string, removeFromExpirationWatcher: boolean = true): void { assert.doesConformToSchema('orderHash', orderHash, schemas.orderHashSchema); const signedOrder = this._orderByOrderHash[orderHash]; if (_.isUndefined(signedOrder)) { @@ -139,7 +139,9 @@ export class OrderStateWatcher { this._removeFromDependentOrderHashes(signedOrder.maker, signedOrder.makerTokenAddress, orderHash); } - this._expirationWatcher.removeOrder(orderHash); + if (removeFromExpirationWatcher) { + this._expirationWatcher.removeOrder(orderHash); + } } /** * Starts an orderStateWatcher subscription. The callback will be called every time a watched order's @@ -212,7 +214,7 @@ export class OrderStateWatcher { error: ExchangeContractErrs.OrderFillExpired, }; if (!_.isUndefined(this._orderByOrderHash[orderHash])) { - this.removeOrder(orderHash); + this.removeOrder(orderHash, false); if (!_.isUndefined(this._callbackIfExists)) { this._callbackIfExists(null, orderState); } -- cgit v1.2.3