[Groonga-commit] droonga/droonga-engine at 4b56998 [master] Cache file path

Zurück zum Archiv-Index

YUKI Hiroshi null+****@clear*****
Fri May 9 15:00:31 JST 2014


YUKI Hiroshi	2014-05-09 15:00:31 +0900 (Fri, 09 May 2014)

  New Revision: 4b56998538dee651c20b349a3ca840312d45d193
  https://github.com/droonga/droonga-engine/commit/4b56998538dee651c20b349a3ca840312d45d193

  Message:
    Cache file path

  Modified files:
    lib/droonga/live_nodes_list_observer.rb

  Modified: lib/droonga/live_nodes_list_observer.rb (+8 -3)
===================================================================
--- lib/droonga/live_nodes_list_observer.rb    2014-05-09 14:49:49 +0900 (ac292c9)
+++ lib/droonga/live_nodes_list_observer.rb    2014-05-09 15:00:31 +0900 (c803398)
@@ -25,7 +25,8 @@ module Droonga
 
     def initialize
       @listener = Listen.to(directory_path) do |modified, added, removed|
-        if added == file_path or modified == file_path
+        if added.include?(file_path) or
+             modified.include?(file_path)
           load_list!
         end
       end
@@ -46,8 +47,7 @@ module Droonga
     end
 
     def file_path
-      path = ENV["DROONGA_LIVE_NODES_LIST"] || DEFAULT_LIST_PATH
-      File.expand_path(path, base_path)
+      @file_path ||= prepare_file_path
     end
 
     def directory_path
@@ -63,6 +63,11 @@ module Droonga
     end
 
     private
+    def prepare_file_path
+      path = ENV["DROONGA_LIVE_NODES_LIST"] || DEFAULT_LIST_PATH
+      File.expand_path(path, base_path)
+    end
+
     def log_tag
       "live-nodes-list-observer"
     end
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Zurück zum Archiv-Index