Navigation Menu

Skip to content

Commit

Permalink
Manage role of myself via NodeRole.my_role globally
Browse files Browse the repository at this point in the history
  • Loading branch information
piroor committed Apr 21, 2015
1 parent b020393 commit 096abec
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/droonga/command/remote.rb
Expand Up @@ -18,7 +18,7 @@
require "droonga/path"
require "droonga/serf"
require "droonga/node_name"
require "droonga/node_metadata"
require "droonga/node_role"
require "droonga/catalog/generator"
require "droonga/catalog/modifier"
require "droonga/catalog/fetcher"
Expand Down Expand Up @@ -119,6 +119,7 @@ class ChangeRole < Base
def process
log("old role: #{@serf.role}")
@serf.role = @params["role"]
NodeRole.my_role = @serf.role
log("new role: #{@serf.role}")
end
end
Expand Down
2 changes: 2 additions & 0 deletions lib/droonga/serf.rb
Expand Up @@ -67,6 +67,7 @@ def run_agent(loop)
set_tag("type", "engine")
set_tag("role", role)
set_tag("cluster_id", cluster_id)
NodeRole.my_role = role
end
agent.start
logger.trace("run_agent: done")
Expand Down Expand Up @@ -199,6 +200,7 @@ def role=(new_role)
role = NodeRole.new(new_role)
set_tag("role", role.to_s)
# after that you must run update_cluster_state to update the cluster information cache
role.to_s
end

def last_processed_message_timestamp
Expand Down

0 comments on commit 096abec

Please sign in to comment.