aboutsummaryrefslogtreecommitdiffstats
path: root/packages/order-watcher/src/order_watcher/expiration_watcher.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/order-watcher/src/order_watcher/expiration_watcher.ts')
-rw-r--r--packages/order-watcher/src/order_watcher/expiration_watcher.ts14
1 files changed, 7 insertions, 7 deletions
diff --git a/packages/order-watcher/src/order_watcher/expiration_watcher.ts b/packages/order-watcher/src/order_watcher/expiration_watcher.ts
index 31fda7dca..6eadf14c7 100644
--- a/packages/order-watcher/src/order_watcher/expiration_watcher.ts
+++ b/packages/order-watcher/src/order_watcher/expiration_watcher.ts
@@ -13,10 +13,10 @@ const DEFAULT_ORDER_EXPIRATION_CHECKING_INTERVAL_MS = 50;
* It stores them in a min heap by expiration time and checks for expired ones every `orderExpirationCheckingIntervalMs`
*/
export class ExpirationWatcher {
- private _orderHashByExpirationRBTree: RBTree<string>;
- private _expiration: { [orderHash: string]: BigNumber } = {};
- private _orderExpirationCheckingIntervalMs: number;
- private _expirationMarginMs: number;
+ private readonly _orderHashByExpirationRBTree: RBTree<string>;
+ private readonly _expiration: { [orderHash: string]: BigNumber } = {};
+ private readonly _orderExpirationCheckingIntervalMs: number;
+ private readonly _expirationMarginMs: number;
private _orderExpirationCheckingIntervalIdIfExists?: NodeJS.Timer;
constructor(expirationMarginIfExistsMs?: number, orderExpirationCheckingIntervalIfExistsMs?: number) {
this._orderExpirationCheckingIntervalMs =
@@ -44,7 +44,7 @@ export class ExpirationWatcher {
this._orderExpirationCheckingIntervalIdIfExists = intervalUtils.setInterval(
this._pruneExpiredOrders.bind(this, callback),
this._orderExpirationCheckingIntervalMs,
- _.noop, // _pruneExpiredOrders never throws
+ _.noop.bind(_), // _pruneExpiredOrders never throws
);
}
public unsubscribe(): void {
@@ -68,8 +68,8 @@ export class ExpirationWatcher {
private _pruneExpiredOrders(callback: (orderHash: string) => void): void {
const currentUnixTimestampMs = utils.getCurrentUnixTimestampMs();
while (true) {
- const hasTrakedOrders = this._orderHashByExpirationRBTree.size === 0;
- if (hasTrakedOrders) {
+ const hasNoTrackedOrders = this._orderHashByExpirationRBTree.size === 0;
+ if (hasNoTrackedOrders) {
break;
}
const nextOrderHashToExpire = this._orderHashByExpirationRBTree.min();