Kouhei Sutou
null+****@clear*****
Mon Jan 5 17:23:13 JST 2015
Kouhei Sutou 2015-01-05 17:23:13 +0900 (Mon, 05 Jan 2015) New Revision: 04a645319e8b76f41c05d6b0f2420c1070860c2a https://github.com/droonga/droonga-engine/commit/04a645319e8b76f41c05d6b0f2420c1070860c2a Message: serf-agent: support on_failure callback Modified files: lib/droonga/serf_agent.rb Modified: lib/droonga/serf_agent.rb (+3 -1) =================================================================== --- lib/droonga/serf_agent.rb 2015-01-05 17:17:33 +0900 (b26afd7) +++ lib/droonga/serf_agent.rb 2015-01-05 17:23:13 +0900 (6ff5c16) @@ -30,6 +30,7 @@ module Droonga MAX_N_READ_CHECKS = 10 attr_writer :on_ready + attr_writer :on_failure def initialize(loop, serf, host, bind_port, rpc_port, *options) @loop = loop @serf = serf @@ -39,6 +40,7 @@ module Droonga @options = options @pid = nil @on_ready = nil + @on_failure = nil @n_ready_checks = 0 end @@ -179,7 +181,7 @@ module Droonga on_connect_failed = lambda do if @n_ready_checks >= MAX_N_READ_CHECKS - # TODO: @on_fail.call if @on_fail + @on_failure.call if @on_failure else timer = Coolio::TimerWatcher.new(1) on_timer = lambda do -------------- next part -------------- HTML����������������������������... Download