Skip to content

Commit 0f2028b

Browse files
committed
fix: Ensure span.finish() is called once in the Promise's .finally() block
1 parent af0daca commit 0f2028b

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

valhalla/jawn/src/utils/traceDecorator.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ export function Trace(configOrName?: string | TraceConfig) {
7878
span.setTag(k, v as any);
7979
}
8080
}
81+
span.finish();
8182
return result;
8283
}
8384
} catch (error) {
@@ -89,13 +90,8 @@ export function Trace(configOrName?: string | TraceConfig) {
8990
span.setTag(k, v as any);
9091
}
9192
}
93+
span.finish();
9294
throw error;
93-
} finally {
94-
// If it was a Promise we already finished in finally above
95-
// This covers sync functions
96-
try {
97-
span.finish();
98-
} catch {}
9995
}
10096
};
10197

0 commit comments

Comments
 (0)