diff --git a/ts/services/backups/index.ts b/ts/services/backups/index.ts index cefb59c13bd1..c2b547a4e8c9 100644 --- a/ts/services/backups/index.ts +++ b/ts/services/backups/index.ts @@ -302,7 +302,7 @@ export class BackupsService { log.info(`importBackup: starting ${backupType}...`); this.isRunning = 'import'; - + const importStart = Date.now(); try { const importStream = await BackupImportStream.create(backupType); if (backupType === BackupType.Ciphertext) { @@ -390,7 +390,9 @@ export class BackupsService { this.isRunning = false; window.IPC.stopTrackingQueryStats({ epochName: 'Backup Import' }); if (window.SignalCI) { - window.SignalCI.handleEvent('backupImportComplete', null); + window.SignalCI.handleEvent('backupImportComplete', { + duration: Date.now() - importStart, + }); } } } diff --git a/ts/test-mock/benchmarks/backup_bench.ts b/ts/test-mock/benchmarks/backup_bench.ts index 9cbe1ee4fe5d..a930b0ac35d0 100644 --- a/ts/test-mock/benchmarks/backup_bench.ts +++ b/ts/test-mock/benchmarks/backup_bench.ts @@ -19,19 +19,15 @@ Bootstrap.benchmark(async (bootstrap: Bootstrap): Promise => { await server.storeBackupOnCdn(backupId, backupStream); - const importStart = Date.now(); - const app = await bootstrap.link(); - await app.waitForBackupImportComplete(); - - const importEnd = Date.now(); + const { duration: importDuration } = await app.waitForBackupImportComplete(); const exportStart = Date.now(); await app.uploadBackup(); const exportEnd = Date.now(); console.log('run=%d info=%j', 0, { - importDuration: importEnd - importStart, + importDuration, exportDuration: exportEnd - exportStart, }); }); diff --git a/ts/test-mock/playwright.ts b/ts/test-mock/playwright.ts index e2b09ab267dc..7760663c8fc4 100644 --- a/ts/test-mock/playwright.ts +++ b/ts/test-mock/playwright.ts @@ -109,7 +109,7 @@ export class App extends EventEmitter { return this.waitForEvent('contactSync'); } - public async waitForBackupImportComplete(): Promise { + public async waitForBackupImportComplete(): Promise<{ duration: number }> { return this.waitForEvent('backupImportComplete'); }