@@ -34,10 +34,10 @@ def send_command(method, *args, **kwargs, &block) # rubocop:disable Metrics/AbcS
34
34
@node . call_primaries ( method , *args , **kwargs , &block ) . first
35
35
when 'ping' then @node . send_ping ( method , *args , **kwargs , &block ) . first
36
36
when 'wait' then send_wait_command ( method , *args , **kwargs , &block )
37
- when 'keys' then @node . call_replicas ( method , *args , **kwargs , &block ) . flatten . sort
38
- when 'dbsize' then @node . call_replicas ( method , *args , **kwargs , &block ) . sum
37
+ when 'keys' then @node . call_replicas ( method , *args , **kwargs , &block ) . flatten . sort_by ( & :to_s )
38
+ when 'dbsize' then @node . call_replicas ( method , *args , **kwargs , &block ) . select { | e | e . is_a? ( Integer ) } . sum
39
39
when 'scan' then scan ( *command , **kwargs )
40
- when 'lastsave' then @node . call_all ( method , *args , **kwargs , &block ) . sort
40
+ when 'lastsave' then @node . call_all ( method , *args , **kwargs , &block ) . sort_by ( & :to_i )
41
41
when 'role' then @node . call_all ( method , *args , **kwargs , &block )
42
42
when 'config' then send_config_command ( method , *args , **kwargs , &block )
43
43
when 'client' then send_client_command ( method , *args , **kwargs , &block )
@@ -221,11 +221,11 @@ def send_pubsub_command(method, *args, **kwargs, &block) # rubocop:disable Metri
221
221
command = method == :blocking_call && args . size > 1 ? args [ 1 ..] : args
222
222
223
223
case command [ 1 ] . to_s . downcase
224
- when 'channels' then @node . call_all ( method , *args , **kwargs , &block ) . flatten . uniq . sort
224
+ when 'channels' then @node . call_all ( method , *args , **kwargs , &block ) . flatten . uniq . sort_by ( & :to_s )
225
225
when 'numsub'
226
226
@node . call_all ( method , *args , **kwargs , &block ) . reject ( &:empty? ) . map { |e | Hash [ *e ] }
227
227
. reduce ( { } ) { |a , e | a . merge ( e ) { |_ , v1 , v2 | v1 + v2 } }
228
- when 'numpat' then @node . call_all ( method , *args , **kwargs , &block ) . sum
228
+ when 'numpat' then @node . call_all ( method , *args , **kwargs , &block ) . select { | e | e . is_a? ( Integer ) } . sum
229
229
else assign_node ( *command ) . send ( method , *args , **kwargs , &block )
230
230
end
231
231
end
0 commit comments