aboutsummaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2017-11-21 06:17:23 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2017-11-21 06:17:23 +0800
commitb01a4af99ed246cda6307ea10303ad25d2cadbe0 (patch)
tree813be6edb9967a38dad1b4c478a661d29a4ce192 /packages
parent9745d5348c7cbef0d0b16fafa2453acfc6cb2c1f (diff)
downloaddexon-sol-tools-b01a4af99ed246cda6307ea10303ad25d2cadbe0.tar
dexon-sol-tools-b01a4af99ed246cda6307ea10303ad25d2cadbe0.tar.gz
dexon-sol-tools-b01a4af99ed246cda6307ea10303ad25d2cadbe0.tar.bz2
dexon-sol-tools-b01a4af99ed246cda6307ea10303ad25d2cadbe0.tar.lz
dexon-sol-tools-b01a4af99ed246cda6307ea10303ad25d2cadbe0.tar.xz
dexon-sol-tools-b01a4af99ed246cda6307ea10303ad25d2cadbe0.tar.zst
dexon-sol-tools-b01a4af99ed246cda6307ea10303ad25d2cadbe0.zip
Rename
Diffstat (limited to 'packages')
-rw-r--r--packages/0x.js/src/order_watcher/expiration_watcher.ts16
1 files changed, 8 insertions, 8 deletions
diff --git a/packages/0x.js/src/order_watcher/expiration_watcher.ts b/packages/0x.js/src/order_watcher/expiration_watcher.ts
index 933cb6f1d..7d6ce6bdd 100644
--- a/packages/0x.js/src/order_watcher/expiration_watcher.ts
+++ b/packages/0x.js/src/order_watcher/expiration_watcher.ts
@@ -14,7 +14,7 @@ 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 orderHashRBTreeByExpiration: RBTree<string>;
+ private orderHashByExpirationRBTree: RBTree<string>;
private expiration: {[orderHash: string]: BigNumber} = {};
private orderExpirationCheckingIntervalMs: number;
private expirationMarginMs: number;
@@ -27,7 +27,7 @@ export class ExpirationWatcher {
DEFAULT_ORDER_EXPIRATION_CHECKING_INTERVAL_MS;
const scoreFunction = (orderHash: string) => this.expiration[orderHash].toNumber();
const comparator = (lhs: string, rhs: string) => scoreFunction(lhs) - scoreFunction(rhs);
- this.orderHashRBTreeByExpiration = new RBTree(comparator);
+ this.orderHashByExpirationRBTree = new RBTree(comparator);
}
public subscribe(callback: (orderHash: string) => void): void {
if (!_.isUndefined(this.orderExpirationCheckingIntervalIdIfExists)) {
@@ -46,22 +46,22 @@ export class ExpirationWatcher {
}
public addOrder(orderHash: string, expirationUnixTimestampMs: BigNumber): void {
this.expiration[orderHash] = expirationUnixTimestampMs;
- this.orderHashRBTreeByExpiration.insert(orderHash);
+ this.orderHashByExpirationRBTree.insert(orderHash);
}
public removeOrder(orderHash: string): void {
- this.orderHashRBTreeByExpiration.remove(orderHash);
+ this.orderHashByExpirationRBTree.remove(orderHash);
delete this.expiration[orderHash];
}
private pruneExpiredOrders(callback: (orderHash: string) => void): void {
const currentUnixTimestampMs = utils.getCurrentUnixTimestampMs();
while (
- this.orderHashRBTreeByExpiration.size !== 0 &&
- this.expiration[this.orderHashRBTreeByExpiration.min()].lessThan(
+ this.orderHashByExpirationRBTree.size !== 0 &&
+ this.expiration[this.orderHashByExpirationRBTree.min()].lessThan(
currentUnixTimestampMs.plus(this.expirationMarginMs),
)
) {
- const orderHash = this.orderHashRBTreeByExpiration.min();
- this.orderHashRBTreeByExpiration.remove(orderHash);
+ const orderHash = this.orderHashByExpirationRBTree.min();
+ this.orderHashByExpirationRBTree.remove(orderHash);
delete this.expiration[orderHash];
callback(orderHash);
}