Skip to content

Commit e955eb4

Browse files
2869
1 parent 6ca1a03 commit e955eb4

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

lib/mongo/cluster/reapers/cursor_reaper.rb

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -123,11 +123,9 @@ def read_scheduled_kill_specs
123123
db_name: db_name,
124124
service_id: service_id
125125
)
126-
@mutex.synchronize do
127-
if @active_cursor_ids.include?(kill_spec.cursor_id)
128-
@to_kill[seed] ||= Set.new
129-
@to_kill[seed] << kill_spec
130-
end
126+
if @active_cursor_ids.include?(kill_spec.cursor_id)
127+
@to_kill[seed] ||= Set.new
128+
@to_kill[seed] << kill_spec
131129
end
132130
end
133131
end
@@ -144,11 +142,11 @@ def kill_cursors
144142
# TODO optimize this to batch kill cursor operations for the same
145143
# server/database/collection instead of killing each cursor
146144
# individually.
147-
148145
loop do
149146
server_address_str = nil
150147

151148
kill_spec = @mutex.synchronize do
149+
read_scheduled_kill_specs
152150
# Find a server that has any cursors scheduled for destruction.
153151
server_address_str, specs =
154152
@to_kill.detect { |server_address_str, specs| specs.any? }

0 commit comments

Comments
 (0)