Repository navigation
fix(cli): prevent analytics thread from blocking command exit - #1342
mikemikimike wants to merge 1 commit into
Conversation
Signed-off-by: mikemikimike <13286568797@163.com>
652cc41 to
c7d3a09
Compare
|
Thanks for looking at #1333. I dug into it with a clean-env repro on 3.13, and the analytics thread turns out not to be the cause: the hang reproduces non-interactively, where the promo (and therefore The actual cause is |
Fixes #1333
Summary
The CLI analytics helper starts a background request thread for the cloud promo path. Because the thread was non-daemon, one-shot commands such as
bm schema validatecould finish their work and output while Python interpreter shutdown waited indefinitely for the analytics request.This change makes the best-effort analytics thread daemonized, so analytics cannot keep the CLI process alive. The existing request timeout and silent failure behavior are unchanged. A regression assertion verifies the thread is created as a daemon.
Tests
uv run --frozen pytest tests/cli/test_analytics.py tests/cli/test_cli_schema.py -q --no-cov(28 passed)uv run --frozen ruff check src/basic_memory/cli/analytics.py tests/cli/test_analytics.pyuv run --frozen ruff format --check src/basic_memory/cli/analytics.py tests/cli/test_analytics.pygit diff --check