From fd6f1a684f7fa919664300089dfdb28b95a02ff0 Mon Sep 17 00:00:00 2001 From: JarbasAI <33701864+JarbasAl@users.noreply.github.com> Date: Mon, 23 Oct 2023 23:25:12 +0100 Subject: [PATCH] fix/huge_integer_error (#58) --- ovos_bus_client/session.py | 6 +++--- test/unittests/test_session.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ovos_bus_client/session.py b/ovos_bus_client/session.py index 7a8fb94..6f41e76 100644 --- a/ovos_bus_client/session.py +++ b/ovos_bus_client/session.py @@ -96,7 +96,7 @@ def __init__(self, timeout: int = None, config = Configuration().get('context', {}) if timeout is None: - timeout = config.get('timeout', 2) + timeout = config.get('timeout', 2) * 60 # minutes to seconds if greedy is None: greedy = config.get('greedy', False) if keywords is None: @@ -105,7 +105,7 @@ def __init__(self, timeout: int = None, max_frames = config.get('max_frames', 3) self.frame_stack = frame_stack or [] - self.timeout = timeout * 60 # minutes to seconds + self.timeout = timeout self.context_keywords = keywords self.context_max_frames = max_frames self.context_greedy = greedy @@ -125,7 +125,7 @@ def deserialize(data: dict): @param data: serialized (dict) data @return: IntentContextManager for the specified data """ - timeout = data.get("timeout", 2) + timeout = data.get("timeout", 2 * 60) framestack = [(IntentContextManagerFrame.deserialize(f), t) for (f, t) in data.get("frame_stack", [])] return IntentContextManager(timeout, framestack) diff --git a/test/unittests/test_session.py b/test/unittests/test_session.py index 76f8190..96d6869 100644 --- a/test/unittests/test_session.py +++ b/test/unittests/test_session.py @@ -177,7 +177,7 @@ def test_serialize_deserialize(self): new_ctx = new_serial.pop('context') self.assertEqual(new_serial, serialized) self.assertEqual(ctx['frame_stack'], new_ctx['frame_stack']) - self.assertGreater(new_ctx['timeout'], ctx['timeout']) + self.assertEqual(new_ctx['timeout'], ctx['timeout']) # Test default value deserialize test_session = Session.deserialize(dict())