Skip to content

Commit

Permalink
Return actually restarted or not
Browse files Browse the repository at this point in the history
  • Loading branch information
piroor committed Apr 21, 2015
1 parent b3192cc commit 7938224
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/droonga/serf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -224,11 +224,17 @@ def cluster_id
def ensure_restarted(&block)
start_time = Time.now
previous_internal_name = get_tag("internal-name")
restarted = false

yield # the given operation must restart the service.
while Time.now - start_time < CHECK_RESTARTED_TIMEOUT and
get_tag("internal-name") == previous_internal_name

while Time.now - start_time < CHECK_RESTARTED_TIMEOUT
restarted = get_tag("internal-name") == previous_internal_name
break if restarted
sleep(CHECK_RESTARTED_INTERVAL)
end

restarted
end

private
Expand Down

0 comments on commit 7938224

Please sign in to comment.