Skip to content

Commit 144c2b1

Browse files
committed
fix(FluidDex): optimize reserve update interval task initialization
1 parent 0780f53 commit 144c2b1

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/dex/fluid-dex/fluid-dex.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -128,11 +128,14 @@ export class FluidDex extends SimpleExchange implements IDex<FluidDexData> {
128128
);
129129

130130
if (!this.dexHelper.config.isSlave) {
131-
await this.liquidityProxy.fetchAndSetState(blockNumber);
132-
this.reserveUpdateIntervalTask = setInterval(
133-
this.updateReserves.bind(this),
134-
RESERVE_REFRESH_INTERVAL_MS,
135-
);
131+
void this.updateReserves();
132+
133+
if (!this.reserveUpdateIntervalTask) {
134+
this.reserveUpdateIntervalTask = setInterval(
135+
this.updateReserves.bind(this),
136+
RESERVE_REFRESH_INTERVAL_MS,
137+
);
138+
}
136139
}
137140
}
138141

0 commit comments

Comments
 (0)