From e567d5017d607be5ce71ef33d5b0b30bc86bef0a Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Thu, 13 Jul 2023 04:35:29 -0400 Subject: [PATCH] refactor: call getLatestExecution in sync and add an arg to getLatestExecution to skip syncing --- src/baseClient.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/baseClient.ts b/src/baseClient.ts index 6e9d3f7..4c78329 100644 --- a/src/baseClient.ts +++ b/src/baseClient.ts @@ -72,6 +72,7 @@ export default abstract class BaseClient { await init("herumi"); await this._sync(); + await this.getLatestExecution(false); } public getCurrentPeriod(): number { @@ -187,8 +188,10 @@ export default abstract class BaseClient { } } - async getLatestExecution(): Promise { - await this._sync(); + async getLatestExecution(sync = true): Promise { + if (sync) { + await this._sync(); + } const getExecInfo = (u: OptimisticUpdate) => { return {