Skip to content

fix: LiveStream tail loop ran forever with no way to stop it#36

Merged
alubbock merged 1 commit intomainfrom
fix/livestream-exit
Mar 13, 2026
Merged

fix: LiveStream tail loop ran forever with no way to stop it#36
alubbock merged 1 commit intomainfrom
fix/livestream-exit

Conversation

@alubbock
Copy link
Copy Markdown
Owner

Summary

  • LiveStream.__init__ ran the file-tailing loop inline, blocking forever. Because the constructor never returned, stop() was unreachable from outside — making it useless.
  • Redesigned to run the loop in a background daemon thread so __init__ returns immediately with a usable object
  • Added stop() to signal termination and join() to wait for the thread to finish
  • Replaced time.sleep() with threading.Event.wait() so stop() responds promptly rather than waiting out a full sleep interval
  • Exceptions in the processing loop are now caught and logged rather than silently killing the thread
  • Adds microbench/tests/test_livestream.py with two tests covering normal processing and stop() termination

@alubbock alubbock force-pushed the fix/livestream-exit branch from 62d924c to 5eb2ca9 Compare March 12, 2026 23:51
@alubbock alubbock merged commit f3b802c into main Mar 13, 2026
20 checks passed
@alubbock alubbock deleted the fix/livestream-exit branch March 13, 2026 00:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant