Skip to content

Commit a2be3fb

Browse files
edanielsDivjot Arora
authored andcommitted
GODRIVER-1351 - Move defer conn.Close to after successful connection in changestream (#200)
1 parent cfbb600 commit a2be3fb

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

mongo/change_stream.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,11 +216,10 @@ func (cs *ChangeStream) executeOperation(ctx context.Context, resuming bool) err
216216

217217
conn.Close()
218218
conn, err = server.Connection(ctx)
219-
defer conn.Close()
220-
221219
if err != nil {
222220
break
223221
}
222+
defer conn.Close()
224223

225224
wireVersion := conn.Description().WireVersion
226225
if wireVersion == nil || wireVersion.Max < 6 {

0 commit comments

Comments
 (0)