lib/mongo/cluster/reapers/cursor_reaper.rb
Method kill_cursors
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
Open
def kill_cursors
# TODO optimize this to batch kill cursor operations for the same
# server/database/collection instead of killing each cursor
# individually.
loop do
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method kill_cursors
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def kill_cursors
# TODO optimize this to batch kill cursor operations for the same
# server/database/collection instead of killing each cursor
# individually.
loop do
Method read_scheduled_kill_specs
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
def read_scheduled_kill_specs
while kill_spec = @kill_spec_queue.pop(true)
if @active_cursor_ids.include?(kill_spec.cursor_id)
@to_kill[kill_spec.server_address] ||= Set.new
@to_kill[kill_spec.server_address] << kill_spec
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"