aboutsummaryrefslogtreecommitdiffstats
path: root/packages/order-watcher/src/order_watcher/order_watcher.ts
diff options
context:
space:
mode:
authoramaurer <git@maurer.me>2018-10-08 00:24:42 +0800
committeramaurer <git@maurer.me>2018-10-08 00:24:42 +0800
commit2e1222556ff8bd3923a5e91174f7d6bd92d6a02c (patch)
tree5b3d05fe780a75c9c4b5842dced803e864782a81 /packages/order-watcher/src/order_watcher/order_watcher.ts
parent9171f9ec600b04134e0f86741e60a973618839b5 (diff)
downloaddexon-sol-tools-2e1222556ff8bd3923a5e91174f7d6bd92d6a02c.tar
dexon-sol-tools-2e1222556ff8bd3923a5e91174f7d6bd92d6a02c.tar.gz
dexon-sol-tools-2e1222556ff8bd3923a5e91174f7d6bd92d6a02c.tar.bz2
dexon-sol-tools-2e1222556ff8bd3923a5e91174f7d6bd92d6a02c.tar.lz
dexon-sol-tools-2e1222556ff8bd3923a5e91174f7d6bd92d6a02c.tar.xz
dexon-sol-tools-2e1222556ff8bd3923a5e91174f7d6bd92d6a02c.tar.zst
dexon-sol-tools-2e1222556ff8bd3923a5e91174f7d6bd92d6a02c.zip
Changed getWatchedOrders to getStats and returns Stats object
Diffstat (limited to 'packages/order-watcher/src/order_watcher/order_watcher.ts')
-rw-r--r--packages/order-watcher/src/order_watcher/order_watcher.ts12
1 files changed, 9 insertions, 3 deletions
diff --git a/packages/order-watcher/src/order_watcher/order_watcher.ts b/packages/order-watcher/src/order_watcher/order_watcher.ts
index e59b56b90..4401b3f7e 100644
--- a/packages/order-watcher/src/order_watcher/order_watcher.ts
+++ b/packages/order-watcher/src/order_watcher/order_watcher.ts
@@ -57,6 +57,10 @@ interface OrderStateByOrderHash {
[orderHash: string]: OrderState;
}
+export interface Stats {
+ orderCount: number;
+}
+
const DEFAULT_ORDER_WATCHER_CONFIG: OrderWatcherConfig = {
orderExpirationCheckingIntervalMs: 50,
eventPollingIntervalMs: 200,
@@ -214,10 +218,12 @@ export class OrderWatcher {
intervalUtils.clearAsyncExcludingInterval(this._cleanupJobIntervalIdIfExists);
}
/**
- * Gets number of orderHashes currently being watched by the order watcher instance.
+ * Gets statistics of the OrderWatcher Instance.
*/
- public getWatchCount(): number {
- return _.size(this._orderByOrderHash);
+ public getStats(): Stats {
+ return {
+ orderCount : _.size(this._orderByOrderHash),
+ };
}
private async _cleanupAsync(): Promise<void> {
for (const orderHash of _.keys(this._orderByOrderHash)) {