Skip to content

Commit b5cee38

Browse files
fix: properly shutdown telemetry aiohttp sessions to prevent ImportError during Python shutdown
- Change atexit handler from flush() to shutdown() in telemetry/__init__.py - This ensures PostHog aiohttp sessions are properly closed before Python shutdown - Prevents ''ImportError: sys.meta_path is None, Python is likely shutting down'' error - Maintains backward compatibility with existing functionality Fixes #963 Co-authored-by: Mervin Praison <[email protected]>
1 parent 9d9ce68 commit b5cee38

File tree

1 file changed

+2
-2
lines changed
  • src/praisonai-agents/praisonaiagents/telemetry

1 file changed

+2
-2
lines changed

src/praisonai-agents/praisonaiagents/telemetry/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ def _ensure_atexit():
6565
])
6666

6767
if not telemetry_disabled:
68-
# Register atexit handler to flush telemetry on exit
69-
atexit.register(lambda: get_telemetry().flush())
68+
# Register atexit handler to properly shutdown telemetry on exit
69+
atexit.register(lambda: get_telemetry().shutdown())
7070
_atexit_registered = True
7171

7272
def _initialize_telemetry():

0 commit comments

Comments
 (0)