Navigation Menu

Skip to content

Commit

Permalink
Simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
piroor committed Apr 23, 2015
1 parent fa66be6 commit 9697c9b
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions lib/droonga/engine_node.rb
Expand Up @@ -273,22 +273,20 @@ def set_auto_close_timer
previous_timer = @auto_close_timer
previous_timer.detach if previous_timer

timer = Coolio::TimerWatcher.new(@auto_close_timeout)
@auto_close_timer = Coolio::TimerWatcher.new(@auto_close_timeout)
on_timeout = lambda do
timer.detach
@auto_close_timer.detach
@auto_close_timer = nil
sender = @sender
if sender
if @sender
logger.info("sender for #{name} is automatically closed by timeout.")
sender.shutdown
@sender.shutdown
@sender = nil
end
end
timer.on_timer do
@auto_close_timer.on_timer do
on_timeout.call
end
@loop.attach(timer)
@auto_close_timer = timer
@loop.attach(@auto_close_timer)
end

def log_tag
Expand Down

0 comments on commit 9697c9b

Please sign in to comment.