KoljaB / RealtimeSTT

A robust, efficient, low-latency speech-to-text library with advanced voice activity detection, wake word activation and instant transcription.
MIT License
2.09k stars 190 forks source link

prevent shutdown from hanging on Windows #104

Open JayDeezus opened 3 months ago

JayDeezus commented 3 months ago

on my system (Windows) queue.get() with no arguments will just hang during shutdown. I'm attempting to preserve the blocking behavior of audio_queue.get() with arguments True and 1.

See https://docs.python.org/3/library/queue.html#queue.Queue.get for details. Specifically:

""" Prior to 3.0 on POSIX systems, and for all versions on Windows, if block is true and timeout is None, this operation goes into an uninterruptible wait on an underlying lock. This means that no exceptions can occur, and in particular a SIGINT will not trigger a KeyboardInterrupt. """

JayDeezus commented 3 months ago

please disregard this request, as I did not test this code enough and am still experiencing some breakage.

JayDeezus commented 3 months ago

I think my suggested edit is still valid, as without the arguments in queue.get(...) that line will hang on windows and not process a KeyboardInterrupt per the method documentation comments. I was testing my script this morning where I made a subclass inheriting AudioToTextRecorder and overloaded _recording_worker with my edits and had an inconsistent case of the reader process not terminating in time, so I wanted to run the script a few times to see if I could get some insight as to why this was happening.