Skip to content

Commit

Permalink
feat: remove lock for initialize
Browse files Browse the repository at this point in the history
  • Loading branch information
Verisana committed Sep 14, 2023
1 parent c0eb94e commit 4a3d014
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions src/stateful-event-subscriber.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ export abstract class StatefulEventSubscriber<State>

private _lastPublishedTimeMs: number = 0;

private isForcedGenerateStateIsRunning = false;

constructor(
public readonly parentName: string,
_name: string,
Expand Down Expand Up @@ -97,16 +95,8 @@ export abstract class StatefulEventSubscriber<State>
this.logger.debug(
`${this.parentName}: ${this.name}: forced to regenerate state`,
);
if (this.isForcedGenerateStateIsRunning) {
return;
}
this.isForcedGenerateStateIsRunning = true;
try {
const state = await this.generateState(blockNumber);
this.setState(state, blockNumber);
} finally {
this.isForcedGenerateStateIsRunning = false;
}
const state = await this.generateState(blockNumber);
this.setState(state, blockNumber);
} else {
if (this.dexHelper.config.isSlave && this.masterPoolNeeded) {
let stateAsString = await this.dexHelper.cache.hget(
Expand Down

0 comments on commit 4a3d014

Please sign in to comment.