Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added server-timeout config option #215

Merged
merged 1 commit into from
Nov 15, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/inmanta/agent/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ class Agent(AgentEndPoint):
"""

def __init__(self, io_loop, hostname=None, agent_map=None, code_loader=True, env_id=None, poolsize=1):
super().__init__("agent", io_loop, timeout=cfg.server_timeout)
super().__init__("agent", io_loop, timeout=cfg.server_timeout.get())

if agent_map is None:
agent_map = cfg.agent_map.get()
Expand Down Expand Up @@ -276,7 +276,7 @@ def unpause(self, name):
return 404, "No such agent"

if self._enabled[name] is not None:
return
return 200, "already running"

LOGGER.info("Agent assuming primary role for %s" % name)

Expand All @@ -292,14 +292,14 @@ def pause(self, name):
return 404, "No such agent"

if self._enabled[name] is None:
return
return 200, "already paused"

LOGGER.info("Agent lost primary role for %s" % name)

token = self._enabled[name]
self._sched.remove(token)
self._enabled[name] = None
return 200
return 200, "paused"

@protocol.handle(methods.AgentState.set_state)
@gen.coroutine
Expand Down
4 changes: 2 additions & 2 deletions src/inmanta/agent/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@
"run the agent at startup, even if a splay time is set", is_bool)

server_timeout = \
Option("config", "server-timeout", 120,
"Amount of time to wait for a response from the server before we try to reconnect", is_time)
Option("config", "server-timeout", 125,
"Amount of time to wait for a response from the server before we try to reconnect, must be smaller than server.agent-hold", is_time)


##############################
Expand Down
6 changes: 3 additions & 3 deletions src/inmanta/protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -449,13 +449,13 @@ class RESTTransport(Transport):
__data__ = ("message", "blob")
__transport_name__ = "rest"

def __init__(self, endpoint):
def __init__(self, endpoint, connection_timout=120):
super().__init__(endpoint)
self.set_connected()
self._handlers = []
self.token = None
self.token_lock = locks.Lock()
self.connection_timout = 120
self.connection_timout = connection_timout

def _create_base_url(self, properties, msg=None):
"""
Expand Down Expand Up @@ -1361,7 +1361,7 @@ def __init__(self, name, sid, ioloop=None, transport=RESTTransport, timeout=120)
self._sid = sid

LOGGER.debug("Start transport for client %s", self.name)
tr = Transport.create(self._transport, self)
tr = self._transport(self, connection_timout=timeout)
self._transport_instance = tr

@gen.coroutine
Expand Down
2 changes: 1 addition & 1 deletion src/inmanta/server/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ def validate_fact_renew(value):
"The path on the local file system where the dashboard can be found")

agent_timeout = \
Option("server", "agent-timeout", 2,
Option("server", "agent-timeout", 30,
"Time before an agent is considered to be offline", is_time)


Expand Down