Skip to content

Commit 953a094

Browse files
authored
chore: freeze some objects (#204)
1 parent d8feb31 commit 953a094

File tree

5 files changed

+7
-6
lines changed

5 files changed

+7
-6
lines changed

lib/redis_client/cluster/command.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,12 @@ def parse_command_reply(rows)
5050
write?: row[2].include?('write'),
5151
readonly?: row[2].include?('readonly')
5252
)
53-
end || EMPTY_HASH
53+
end.freeze || EMPTY_HASH
5454
end
5555
end
5656

5757
def initialize(commands)
58-
@commands = commands || {}
58+
@commands = commands || EMPTY_HASH
5959
end
6060

6161
def extract_first_key(command)

lib/redis_client/cluster/node.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ def load_info(options, **kwargs) # rubocop:disable Metrics/AbcSize, Metrics/Cycl
127127
end
128128
end
129129

130-
grouped.max_by { |_, v| v.size }[1].first
130+
grouped.max_by { |_, v| v.size }[1].first.freeze
131131
end
132132

133133
private

test/cluster_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -501,6 +501,6 @@ def replica_client?(client)
501501
def print_debug(msg)
502502
return unless @debug == '1'
503503

504-
p msg
504+
p msg # rubocop:disable Lint/Debugger
505505
end
506506
end

test/redis_client/test_cluster.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ def test_dedicated_commands # rubocop:disable Metrics/CyclomaticComplexity, Metr
277277
{ command: %w[MULTI], error: ::RedisClient::Cluster::AmbiguousNodeError },
278278
{ command: %w[FLUSHDB], want: 'OK' }
279279
].each do |c|
280-
next if c.key?(:supported_redis_version) && TEST_REDIS_MAJOR_VERSION < c[:supported_redis_version]
280+
next if c.key?(:supported_redis_version) && c[:supported_redis_version] > TEST_REDIS_MAJOR_VERSION
281281

282282
msg = "Case: #{c[:command].join(' ')}"
283283
got = -> { @client.call_v(c[:command], &c[:blk]) }

test/test_against_cluster_scale.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ def test_02_scale_in
5252
rescue ::RedisClient::CommandError => e
5353
raise unless e.message.start_with?('CLUSTERDOWN Hash slot not served')
5454

55-
p "key#{i}" # FIXME: Why does the error occur?
55+
# FIXME: Why does the error occur?
56+
p "key#{i}" # rubocop:disable Lint/Debugger
5657
end
5758

5859
want = TEST_NODE_URIS.size

0 commit comments

Comments
 (0)