Skip to content

Commit a53a239

Browse files
committed
fix race conditions
1 parent 93932f9 commit a53a239

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/utils/time-tracker.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,18 @@ const timeDiff = (start: number, end: number) =>
55
ms(end - start, { long: true });
66

77
export interface TimeTracker {
8-
run<T>(name: string, fn: () => T): T;
8+
run<T>(name: string, fn: () => Promise<T>): Promise<T>;
99
}
1010

1111
export const createTimeTracker = (options: {
1212
outputChannel: LogOutputChannel;
1313
}): TimeTracker => {
1414
return {
15-
run<T>(name: string, fn: () => T): T {
15+
async run<T>(name: string, fn: () => Promise<T>): Promise<T> {
1616
options.outputChannel.trace(`[${name}]: Starting...`);
1717
const start = Date.now();
1818
try {
19-
const result = fn();
19+
const result = await fn();
2020
const end = Date.now();
2121
options.outputChannel.trace(
2222
`[${name}]: completed in ${timeDiff(start, end)}`,

0 commit comments

Comments
 (0)