Skip to content

Commit

Permalink
Update Dataworker.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholaspai committed Mar 22, 2024
1 parent 62674ce commit 7030ff9
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/dataworker/Dataworker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1880,8 +1880,11 @@ export class Dataworker {
const latestFeesCompoundedTime =
this.clients.hubPoolClient.getLpTokenInfoForL1Token(l1Token)?.lastLpFeeUpdate ?? 0;
// Force update every 2 days:
const timeToNextUpdate = 2 * 24 * 60 * 60 - (this.clients.hubPoolClient.currentTime - latestFeesCompoundedTime);
if (this.clients.hubPoolClient.currentTime === undefined || timeToNextUpdate < 0) {
if (
this.clients.hubPoolClient.currentTime === undefined ||
this.clients.hubPoolClient.currentTime - latestFeesCompoundedTime <= 2 * 24 * 60 * 60
) {
const timeToNextUpdate = 2 * 24 * 60 * 60 - (this.clients.hubPoolClient.currentTime - latestFeesCompoundedTime);
this.logger.debug({
at: "Dataworker#_updateOldExchangeRates",
message: `Skipping exchange rate update for ${tokenSymbol} because it was recently updated. Seconds to next update: ${timeToNextUpdate}s`,
Expand Down Expand Up @@ -1914,7 +1917,6 @@ export class Dataworker {
at: "Dataworker#_updateOldExchangeRates",
message: `Updating exchange rate for ${tokenSymbol}`,
lastUpdateTime: latestFeesCompoundedTime,
timeToNextUpdate,
currentLiquidReserves,
updatedLiquidReserves,
l1Token,
Expand Down

0 comments on commit 7030ff9

Please sign in to comment.