From 6b351876e7c58d0b18af627a9944e473ea448adb Mon Sep 17 00:00:00 2001 From: cte Date: Tue, 11 Feb 2025 10:16:51 -0800 Subject: [PATCH] Add duration logging --- src/services/checkpoints/CheckpointService.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/services/checkpoints/CheckpointService.ts b/src/services/checkpoints/CheckpointService.ts index c2f57a35ab..36bdcb1fb3 100644 --- a/src/services/checkpoints/CheckpointService.ts +++ b/src/services/checkpoints/CheckpointService.ts @@ -188,6 +188,8 @@ export class CheckpointService { } public async saveCheckpoint(message: string) { + const startTime = Date.now() + await this.ensureBranch(this.mainBranch) const stashSha = (await this.git.raw(["stash", "create"])).trim() @@ -334,7 +336,11 @@ export class CheckpointService { await this.restoreMain({ branch: stashBranch, stashSha }) await this.git.branch(["-D", stashBranch]) - this.log(`[saveCheckpoint] saved checkpoint ${commit}`) + + // We've gotten reports that checkpoints can be slow in some cases, so + // we'll log the duration of the checkpoint save. + const duration = Date.now() - startTime + this.log(`[saveCheckpoint] saved checkpoint ${commit} in ${duration}ms`) return { commit } }