fix(core): use Date.now() everywhere for tasks start and end times to avoid negative durations (#18595)

This commit is contained in:
Craigory Coppola 2023-08-15 16:54:44 -05:00 committed by GitHub
parent 54ee90505b
commit 98a7477922
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -27,7 +27,7 @@ export class TaskProfilingLifeCycle implements LifeCycle {
} }
for (let t of tasks) { for (let t of tasks) {
this.timings[t.id] = { this.timings[t.id] = {
perfStart: performance.now(), perfStart: Date.now(),
}; };
} }
} }
@ -43,7 +43,7 @@ export class TaskProfilingLifeCycle implements LifeCycle {
if (tr.task.endTime) { if (tr.task.endTime) {
this.timings[tr.task.id].perfEnd = tr.task.endTime; this.timings[tr.task.id].perfEnd = tr.task.endTime;
} else { } else {
this.timings[tr.task.id].perfEnd = performance.now(); this.timings[tr.task.id].perfEnd = Date.now();
} }
} }
this.recordTaskCompletions(taskResults, metadata); this.recordTaskCompletions(taskResults, metadata);