YUKI Hiroshi
null+****@clear*****
Mon Apr 6 19:31:48 JST 2015
YUKI Hiroshi 2015-04-06 19:31:48 +0900 (Mon, 06 Apr 2015) New Revision: 8c7499a1ae0421f7c14152216b5b87a668375d7c https://github.com/droonga/droonga-engine/commit/8c7499a1ae0421f7c14152216b5b87a668375d7c Message: Correct usage of Coolio::TimerWatcher Modified files: lib/droonga/forwarder.rb Modified: lib/droonga/forwarder.rb (+6 -1) =================================================================== --- lib/droonga/forwarder.rb 2015-04-06 19:31:39 +0900 (ece20dc) +++ lib/droonga/forwarder.rb 2015-04-06 19:31:48 +0900 (2789a4f) @@ -138,15 +138,20 @@ module Droonga previous_timer = @auto_close_timers[destination] previous_timer.detach if previous_timer - timer = Coolio::TimerWatcher.new(@auto_close_timeout_seconds) do + timer = Coolio::TimerWatcher.new(@auto_close_timeout_seconds) + on_timeout = lambda do timer.detach @auto_close_timers.delete(destination) sender = @senders[destination] if sender + logger.info("sender for #{destination} is automatically closed by timeout.") sender.shutdown @senders.delete(destination) end end + timer.on_timer do + on_timeout.call + end @loop.attach(timer) @auto_close_timers[destination] = timer end -------------- next part -------------- HTML����������������������������...Download