refactor: call getLatestExecution in sync and add an arg to getLatestExecution to skip syncing

This commit is contained in:
Derrick Hammer 2023-07-13 04:35:29 -04:00
parent f68688ab61
commit e567d5017d
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 5 additions and 2 deletions

View File

@ -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<ExecutionInfo | null> {
await this._sync();
async getLatestExecution(sync = true): Promise<ExecutionInfo | null> {
if (sync) {
await this._sync();
}
const getExecInfo = (u: OptimisticUpdate) => {
return {