YUKI Hiroshi
null+****@clear*****
Tue Apr 21 20:17:36 JST 2015
YUKI Hiroshi 2015-04-21 20:17:36 +0900 (Tue, 21 Apr 2015) New Revision: 241fdc97f8fead4d00929a3d39713166d6f745f3 https://github.com/droonga/droonga-engine/commit/241fdc97f8fead4d00929a3d39713166d6f745f3 Message: Prepare to wait until all restore messages are completely processed Modified files: lib/droonga/plugins/system/absorb_data.rb Modified: lib/droonga/plugins/system/absorb_data.rb (+15 -1) =================================================================== --- lib/droonga/plugins/system/absorb_data.rb 2015-04-21 20:10:17 +0900 (82c7e0a) +++ lib/droonga/plugins/system/absorb_data.rb 2015-04-21 20:17:36 +0900 (c3436d7) @@ -18,6 +18,7 @@ require "droonga/plugin/async_command" require "droonga/catalog/dataset" require "droonga/serf" require "droonga/node_name" +require "droonga/database_scanner" require "drndump/dump_client" @@ -36,12 +37,19 @@ module Droonga end class DataAbsorber < AsyncCommand::AsyncHandler + include DatabaseScanner + class EmptyResponse < StandardError end class EmptyBody < StandardError end + def initialize(context, loop, messenger, request) + @context = context + super(loop, messenger, request) + end + def start logger.trace("start: start") on_start @@ -50,8 +58,10 @@ module Droonga @dumper = Drndump::DumpClient.new(dumper_params) @dumper.on_finish = lambda do + ensure_completely_restored do on_finish logger.trace("start: finish") + end end @dumper.on_progress = lambda do |message| logger.trace("dump progress", @@ -114,6 +124,10 @@ module Droonga "failed to absorb data" end + def ensure_completely_restored(&block) + yield + end + def on_finish begin if @dumper_error_message @@ -220,7 +234,7 @@ module Droonga private def start(request) - absorber = DataAbsorber.new(loop, messenger, request) + absorber = DataAbsorber.new(@context, loop, messenger, request) absorber.start end end -------------- next part -------------- HTML����������������������������... Download