Skip to content

Conversation

gribnoysup
Copy link
Collaborator

This fixes an issue with Serverless instances of MongoDB where trying to run multiple session commands in parallel is causing driver to throw an error. We learned from the driver team that even though running concurrent session commands works in some cases, it's really not something that we should be doing, so the fix is to have a separate session for every command we are running in parallel here

@gribnoysup gribnoysup changed the title fix(compass-crud): Use separate sessoins for all operations in compass-crud COMPASS-5299 fix(compass-crud): Use separate sessions for all operations in compass-crud COMPASS-5299 Nov 17, 2021
@gribnoysup gribnoysup merged commit 7185a8d into main Nov 17, 2021
@gribnoysup gribnoysup deleted the compass-5299-use-separate-sessions-for-crud-ops branch November 17, 2021 14:07
Copy link
Collaborator

@mcasimir mcasimir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍👍👍

* @param clientSession - a ClientSession (can be created with startSession())
*/
killSession(session: ClientSession): Promise<Document> {
killSession(sessions: ClientSession | ClientSession[]): Promise<Document> {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
killSession(sessions: ClientSession | ClientSession[]): Promise<Document> {
killSessions(sessions: ClientSession | ClientSession[]): Promise<Document> {

this.setState({ sessions: null });
try {
await this.dataService.killSession(session);
await this.dataService.killSession(sessions);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this

Suggested change
await this.dataService.killSession(sessions);
await this.dataService.killSessions(sessions);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants