From d81695dba9d211f44608eeb5dee742a165a43d25 Mon Sep 17 00:00:00 2001 From: Howard Gil Date: Fri, 13 Sep 2024 17:00:22 -0700 Subject: [PATCH] fixed for threading --- agentops/time_travel.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/agentops/time_travel.py b/agentops/time_travel.py index ef833095..207e8888 100644 --- a/agentops/time_travel.py +++ b/agentops/time_travel.py @@ -4,6 +4,9 @@ from .http_client import HttpClient from .exceptions import ApiServerException from .singleton import singleton +import threading + +_time_travel_lock = threading.Lock() @singleton @@ -160,8 +163,9 @@ def set_time_travel_active_state(is_active: bool): def add_time_travel_terminal_indicator(): - if TimeTravel()._initialized is False: - print(f"🖇⏰ AgentOps: Time Travel Activated") + with _time_travel_lock: + if not TimeTravel()._initialized: + print(f"🖇⏰ AgentOps: Time Travel Activated") def reset_terminal():