Skip to content

Commit

Permalink
Clean up connection after scanning
Browse files Browse the repository at this point in the history
  • Loading branch information
felixmo committed May 16, 2024
1 parent 148a503 commit 6e68474
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions lib/mongo/server/monitor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -226,10 +226,24 @@ def scan!
begin
result = do_scan
rescue => e
run_sdam_flow({}, scan_error: e)
flow = run_sdam_flow({}, scan_error: e)
else
run_sdam_flow(result)
flow = run_sdam_flow(result)
end

# Disconnect the connection after scanning so that we do not double our connections to the mongoS.
# STOP THE PUSH MONITOR
if push_monitor
stop_push_monitor!
end

# DISCONNECT THE CONNECTION
if @connection
@connection.disconnect!
@connection = nil
end

flow
end
end

Expand Down

0 comments on commit 6e68474

Please sign in to comment.