Navigation Menu

Skip to content

Commit

Permalink
Set latest internal name as a serf tag.
Browse files Browse the repository at this point in the history
It can be used to detect the service is completely restarted.
  • Loading branch information
piroor committed Apr 21, 2015
1 parent 912d82f commit 7df997e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/droonga/engine.rb
Expand Up @@ -24,6 +24,7 @@
require "droonga/cluster"
require "droonga/catalog/loader"
require "droonga/dispatcher"
require "droonga/serf"

module Droonga
class Engine
Expand All @@ -32,6 +33,7 @@ class Engine

def initialize(loop, name, internal_name)
@name = name
@internal_name = internal_name
@loop = loop
@catalog = load_catalog
@state = EngineState.new(loop, name,
Expand All @@ -47,6 +49,8 @@ def start
logger.trace("start: start")
@state.on_ready = lambda do
on_ready
serf = Serf.new(@name.to_s)
serf.set_tag("internal-name", @internal_name)
end
@state.on_failure = lambda do
on_failure
Expand Down

0 comments on commit 7df997e

Please sign in to comment.