Skip to content

Commit 492b6a1

Browse files
Isolate server selection context
1 parent ee82cd7 commit 492b6a1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

x/mongo/driver/operation.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -422,10 +422,10 @@ func (op Operation) getServerAndConnection(
422422
requestID int32,
423423
deprioritized []description.Server,
424424
) (Server, *mnet.Connection, error) {
425-
ctx, cancel := csot.WithServerSelectionTimeout(ctx, op.Deployment.GetServerSelectionTimeout())
425+
serverSelectionCtx, cancel := csot.WithServerSelectionTimeout(ctx, op.Deployment.GetServerSelectionTimeout())
426426
defer cancel()
427427

428-
server, err := op.selectServer(ctx, requestID, deprioritized)
428+
server, err := op.selectServer(serverSelectionCtx, requestID, deprioritized)
429429
if err != nil {
430430
if op.Client != nil &&
431431
!(op.Client.Committing || op.Client.Aborting) && op.Client.TransactionRunning() {

0 commit comments

Comments
 (0)