[Groonga-commit] droonga/droonga-engine at 5b06f3f [buffered-forward] Don't return "nil" as a volume

Back to archive index

YUKI Hiroshi null+****@clear*****
Thu Jan 15 15:34:55 JST 2015


YUKI Hiroshi	2015-01-15 15:34:55 +0900 (Thu, 15 Jan 2015)

  New Revision: 5b06f3f0b27553707576c046872d294f11dbf171
  https://github.com/droonga/droonga-engine/commit/5b06f3f0b27553707576c046872d294f11dbf171

  Message:
    Don't return "nil" as a volume

  Modified files:
    lib/droonga/catalog/replicas_volume.rb

  Modified: lib/droonga/catalog/replicas_volume.rb (+10 -2)
===================================================================
--- lib/droonga/catalog/replicas_volume.rb    2015-01-15 12:38:43 +0900 (6d29e9e)
+++ lib/droonga/catalog/replicas_volume.rb    2015-01-15 15:34:55 +0900 (244c6c6)
@@ -44,10 +44,18 @@ module Droonga
         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
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index