Skip to content

Commit

Permalink
more perf logging for invalidation
Browse files Browse the repository at this point in the history
  • Loading branch information
habdelra committed Jan 17, 2025
1 parent 9ab9f58 commit ffee41f
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion packages/runtime-common/index-writer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,8 @@ export class Batch {

async invalidate(url: URL): Promise<string[]> {
await this.ready;
let start = Date.now();
this.#perfLog.debug(`starting invalidation of ${url.href}`);
let alias = trimExecutableExtension(url).href;
let visited = new Set<string>();
let invalidations = [
Expand Down Expand Up @@ -447,6 +449,7 @@ export class Batch {
);

let names = flattenDeep(columns);
let insertStart = Date.now();
await this.#query([
'INSERT INTO boxel_index_working',
...addExplicitParens(separatedByCommas(columns)),
Expand All @@ -457,6 +460,15 @@ export class Batch {
'ON CONFLICT ON CONSTRAINT boxel_index_working_pkey DO UPDATE SET',
...separatedByCommas(names.map((name) => [`${name}=EXCLUDED.${name}`])),
] as Expression);
this.#perfLog.debug(
`inserted invalidated rows for ${url.href} in ${
Date.now() - insertStart
} ms`,
);

this.#perfLog.debug(
`completed invalidation of ${url.href} in ${Date.now() - start} ms`,
);

this.#invalidations = new Set([...this.#invalidations, ...invalidations]);
return invalidations;
Expand Down Expand Up @@ -514,7 +526,7 @@ export class Batch {
this.#perfLog.debug(
`time to determine items that reference ${resolvedPath} ${
Date.now() - start
} ms`,
} ms (page count=${pageNumber})`,
);
return results.map(({ url, file_alias, type }) => ({
url,
Expand Down

0 comments on commit ffee41f

Please sign in to comment.