Skip to content

Commit

Permalink
Track latency of initializing caches.
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentwschau committed Dec 12, 2024
1 parent a27fc9f commit 0971f75
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions indexer/services/ender/src/caches/block-cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ function isNextBlock(blockHeight: string): boolean {
* All caches must be initialized in a Transaction to ensure consistency
*/
export async function initializeAllCaches(): Promise<void> {
const start: number = Date.now();
const txId: number = await Transaction.start();
await Transaction.setIsolationLevel(txId, IsolationLevel.READ_COMMITTED);

Expand All @@ -120,6 +121,10 @@ export async function initializeAllCaches(): Promise<void> {
]);

await Transaction.rollback(txId);
stats.timing(
`${config.SERVICE_NAME}.initialize_caches`,
Date.now() - start,
);
}

export function resetBlockCache(): void {
Expand Down

0 comments on commit 0971f75

Please sign in to comment.