From 82e26cda019c071e741ae5ed9602b51633710296 Mon Sep 17 00:00:00 2001 From: JarbasAi Date: Mon, 23 Oct 2023 23:00:03 +0100 Subject: [PATCH 1/2] fix/huge_integer_error timeout is getting multiplied by 60 every time it is serialized/deserialized, conversion from seconds to minutes should only be done when assigning the default value from config ``` exception calling callback for Traceback (most recent call last): File "/usr/lib/python3.11/concurrent/futures/_base.py", line 340, in _invoke_callbacks callback(self) File "/home/ovos/.venv/lib/python3.11/site-packages/pyee/_executor.py", line 57, in _callback self.emit("error", exc) File "/home/ovos/.venv/lib/python3.11/site-packages/pyee/_base.py", line 118, in emit self._emit_handle_potential_error(event, args[0] if args else None) File "/home/ovos/.venv/lib/python3.11/site-packages/pyee/_base.py", line 88, in _emit_handle_potential_error raise error File "/usr/lib/python3.11/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/ovos/.venv/lib/python3.11/site-packages/ovos_bus_client/client/client.py", line 162, in on_default_session_update SessionManager.update(sess, make_default=True) File "/home/ovos/.venv/lib/python3.11/site-packages/ovos_bus_client/session.py", line 538, in update LOG.debug(f"replacing default session with: {sess.serialize()}") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ValueError: Exceeds the limit (4300 digits) for integer string conversion; use sys.set_int_max_str_digits() to increase the limit ``` --- ovos_bus_client/session.py | 6 +++--- 1 file changed, 3 insertions(+), 3 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) From e55cc352e4e4f725d8976bdda16e632901ef7bb1 Mon Sep 17 00:00:00 2001 From: JarbasAi Date: Mon, 23 Oct 2023 23:03:12 +0100 Subject: [PATCH 2/2] test --- test/unittests/test_session.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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())