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

[Jormungandr] Rename INSTANCE'S'_TIMEOUT #4114

Merged
merged 2 commits into from
Sep 27, 2023
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
2 changes: 1 addition & 1 deletion source/jormungandr/jormungandr/default_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
INSTANCES_DIR = os.getenv('JORMUNGANDR_INSTANCES_DIR', '/etc/jormungandr.d')


INSTANCE_TIMEOUT = float(os.getenv('JORMUNGANDR_INSTANCE_TIMEOUT_S', 10))
INSTANCES_TIMEOUT = float(os.getenv('JORMUNGANDR_INSTANCES_TIMEOUT_S', 10))
PLACE_FAST_TIMEOUT = float(os.getenv('JORMUNGANDR_PLACE_FAST_TIMEOUT_S', 1))

# Patern that matches Jormungandr configuration files
Expand Down
2 changes: 1 addition & 1 deletion source/jormungandr/jormungandr/instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -860,7 +860,7 @@ def send_and_receive(self, *args, **kwargs):
except pybreaker.CircuitBreakerError as e:
raise DeadSocketException(self.name, self.socket_path)

def _send_and_receive(self, request, timeout=app.config.get('INSTANCE_TIMEOUT', 10), quiet=False, **kwargs):
def _send_and_receive(self, request, timeout=app.config.get('INSTANCES_TIMEOUT', 10), quiet=False, **kwargs):
deadline = datetime.utcnow() + timedelta(milliseconds=timeout * 1000)
request.deadline = deadline.strftime('%Y%m%dT%H%M%S,%f')

Expand Down
7 changes: 6 additions & 1 deletion source/jormungandr/jormungandr/pt_planners/kraken.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,12 @@

class Kraken(ZmqSocket, AbstractPtPlanner):
def __init__(
self, name, zmq_context, zmq_socket, zmq_socket_type, timeout=app.config.get(str('INSTANCE_TIMEOUT'), 10)
self,
name,
zmq_context,
zmq_socket,
zmq_socket_type,
timeout=app.config.get(str('INSTANCES_TIMEOUT'), 10),
):
super(Kraken, self).__init__(
"pt_planner_kraken_{}".format(name), zmq_context, zmq_socket, zmq_socket_type, timeout
Expand Down
7 changes: 6 additions & 1 deletion source/jormungandr/jormungandr/pt_planners/loki.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,12 @@ class PlannerLokiException(Exception):

class Loki(ZmqSocket, AbstractPtPlanner):
def __init__(
self, name, zmq_context, zmq_socket, zmq_socket_type, timeout=app.config.get(str('INSTANCE_TIMEOUT'), 10)
self,
name,
zmq_context,
zmq_socket,
zmq_socket_type,
timeout=app.config.get(str('INSTANCES_TIMEOUT'), 10),
):
super(Loki, self).__init__(
"pt_planner_loki_{}".format(name), zmq_context, zmq_socket, zmq_socket_type, timeout
Expand Down
2 changes: 1 addition & 1 deletion source/jormungandr/tests/integration_tests_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

DISABLE_DATABASE = True
# for tests we want only 0.5 second timeout instead of the normal 10s
INSTANCE_TIMEOUT = float(os.environ.get('CUSTOM_INSTANCE_TIMEOUT', 0.5))
INSTANCES_TIMEOUT = float(os.environ.get('CUSTOM_INSTANCE_TIMEOUT', 0.5))
STAT_CIRCUIT_BREAKER_MAX_FAIL = int(os.getenv('JORMUNGANDR_STAT_CIRCUIT_BREAKER_MAX_FAIL', 1000))
STAT_CIRCUIT_BREAKER_TIMEOUT_S = int(os.getenv('JORMUNGANDR_STAT_CIRCUIT_BREAKER_TIMEOUT_S', 1))

Expand Down