Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: get stacktrace before any async method call #756

Merged
merged 1 commit into from
Dec 16, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/session-pool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,8 @@ export class SessionPool extends EventEmitter implements SessionPoolInterface {
throw new Error(errors.Closed);
}

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

Expand Down Expand Up @@ -492,7 +494,7 @@ export class SessionPool extends EventEmitter implements SessionPoolInterface {
}
}

this._traces.set(session.id, trace.get());
this._traces.set(session.id, frames);
return session;
}

Expand Down