Navigation Menu

Skip to content

Commit

Permalink
Don't return "nil" as a volume
Browse files Browse the repository at this point in the history
  • Loading branch information
piroor committed Jan 15, 2015
1 parent b693bf9 commit 5b06f3f
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions lib/droonga/catalog/replicas_volume.rb
Expand Up @@ -44,10 +44,18 @@ def select(how=nil, active_nodes=nil)
case how
when :top
replicas = live_replicas(active_nodes)
[replicas.first]
if replicas.empty?
[]
else
[replicas.first]
end
when :random
replicas = live_replicas(active_nodes)
[replicas.sample]
if replicas.empty?
[]
else
[replicas.sample]
end
when :all
live_replicas(active_nodes)
else
Expand Down

0 comments on commit 5b06f3f

Please sign in to comment.