Skip to content

Commit 3091a78

Browse files
olavloitecallmehiphop
authored andcommitted
fix: get stacktrace before any async method call (#756)
1 parent b891a81 commit 3091a78

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/session-pool.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,8 @@ export class SessionPool extends EventEmitter implements SessionPoolInterface {
459459
throw new Error(errors.Closed);
460460
}
461461

462+
// Get the stacktrace of the caller before we call any async methods, as calling an async method will break the stacktrace.
463+
const frames = trace.get();
462464
const startTime = Date.now();
463465
const timeout = this.options.acquireTimeout;
464466

@@ -492,7 +494,7 @@ export class SessionPool extends EventEmitter implements SessionPoolInterface {
492494
}
493495
}
494496

495-
this._traces.set(session.id, trace.get());
497+
this._traces.set(session.id, frames);
496498
return session;
497499
}
498500

0 commit comments

Comments
 (0)