Ver Fonte

Add duration logging

cte há 10 meses atrás
pai
commit
6b351876e7
1 ficheiros alterados com 7 adições e 1 exclusões
  1. 7 1
      src/services/checkpoints/CheckpointService.ts

+ 7 - 1
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 }
 	}