Open JayDeezus opened 3 months ago
I have noticed similar behaviour. I implemented a simple client and server. To test it out, I added print statements to a if connection is none statement in the realtime callback function and after a client disconnects and shutdown is called, the callback keeps on printing and I have had to kill the server process for it to stop. With multiple clients, this will cause huge issues of course.
I am still trying to find the issue as well but I think adding a is_shutdown_state type check and breaking the while loop in _realtime_worker might solve this since the callback does not stop and is called from _realtime_worker. Will test this out tomorrow and update here.
https://github.com/KoljaB/RealtimeSTT/blob/d02be1f6a6757f518864deb3f35a53b6b3563f21/RealtimeSTT/audio_recorder.py#L1209
I'm trying to track down why on my system sometimes (usually) when I Ctrl-C to shut down my app shutdown will hang on the aforementioned line. I tried subclassing and copying the shutdown method and inserting print statements to see how far it gets and it's getting hung while trying to join the recording_thread.
At this point, I'm just trying to separate concerns, so am trying to figure out if I can just stop the task in the thread and get this to join and move on somehow. Currently investigating.