Skip to content

Commit

Permalink
fix: reduce backend l2 fetch constant and remove 5s buffer
Browse files Browse the repository at this point in the history
  • Loading branch information
Aerilym committed Jan 18, 2025
1 parent 178b912 commit a8decbb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions apps/staking/app/register/[nodeId]/multi/SubmitMultiTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ function SubmitMulti({
*
* After this first fetch the `refetchInterval` computes the next l2 update timestamp and
* schedules a refetch 5s after this timestamp.
* (l2_height_timestamp + {@link BACKEND.L2_TARGET_UPDATE_INTERVAL_SECONDS} + 5s)
* (l2_height_timestamp + {@link BACKEND.L2_TARGET_UPDATE_INTERVAL_SECONDS} )
*
* This refetch interval computation continues after each fetch until the contract address is
* available in the query state. Then the interval is disabled and no more refetches are made.
Expand Down Expand Up @@ -494,8 +494,8 @@ function SubmitMulti({

const msUntilNextL2Update = nextL2UpdateTimestampMs - Date.now();

// Update 5s after the next l2 update (no less than 1s from now)
return Math.max(msUntilNextL2Update + 5000, 1000);
// Update at the next l2 update (no less than 1s from now)
return Math.max(msUntilNextL2Update, 1000);
}
},
gcTime: Number.POSITIVE_INFINITY,
Expand Down
4 changes: 2 additions & 2 deletions apps/staking/lib/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,8 @@ export const REGISTRATION_LINKS: Partial<Record<REG_TAB, string>> = {
} as const;

export enum BACKEND {
/** 30 seconds */
L2_TARGET_UPDATE_INTERVAL_SECONDS = 30,
/** 10 seconds */
L2_TARGET_UPDATE_INTERVAL_SECONDS = 10,
/** 2 minutes */
NODE_TARGET_UPDATE_INTERVAL_SECONDS = 2 * 60,
}
Expand Down

0 comments on commit a8decbb

Please sign in to comment.