aboutsummaryrefslogtreecommitdiffstats
path: root/packages/order-watcher/src/order_watcher/expiration_watcher.ts
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2018-07-13 23:45:25 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2018-07-13 23:45:25 +0800
commit95e9f33f6aa5fa7849279062b008afa763a465d8 (patch)
tree085b1303c0576a1bafe471191253a416cbd939d2 /packages/order-watcher/src/order_watcher/expiration_watcher.ts
parentc599a20b34331c6481318d3cd3b01855444f339d (diff)
downloaddexon-sol-tools-95e9f33f6aa5fa7849279062b008afa763a465d8.tar
dexon-sol-tools-95e9f33f6aa5fa7849279062b008afa763a465d8.tar.gz
dexon-sol-tools-95e9f33f6aa5fa7849279062b008afa763a465d8.tar.bz2
dexon-sol-tools-95e9f33f6aa5fa7849279062b008afa763a465d8.tar.lz
dexon-sol-tools-95e9f33f6aa5fa7849279062b008afa763a465d8.tar.xz
dexon-sol-tools-95e9f33f6aa5fa7849279062b008afa763a465d8.tar.zst
dexon-sol-tools-95e9f33f6aa5fa7849279062b008afa763a465d8.zip
Migrate order-watcher to v2
Diffstat (limited to 'packages/order-watcher/src/order_watcher/expiration_watcher.ts')
-rw-r--r--packages/order-watcher/src/order_watcher/expiration_watcher.ts12
1 files changed, 6 insertions, 6 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..c4c94a015 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 =
@@ -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();