From 9613fa85c7208a3412421a7b652fdcddd9cbf1e1 Mon Sep 17 00:00:00 2001 From: Gokul Mohanarangan Date: Thu, 20 Jul 2023 23:29:51 +0530 Subject: [PATCH] fix live UI stuck --- server_executor_cleaned.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/server_executor_cleaned.py b/server_executor_cleaned.py index e818db9f..2d8f3747 100644 --- a/server_executor_cleaned.py +++ b/server_executor_cleaned.py @@ -110,6 +110,11 @@ def channel_send_transcript(channel): del sorted_transcripts[least_time] if message["text"] not in blacklisted_messages: channel.send(json.dumps(message)) + # Due to exceptions if one of the earlier batches can't return + # a transcript, we don't want to be stuck waiting for the result + # With the threshold size of 3, we pop the first(lost) element + elif len(sorted_transcripts) >= 3: + del sorted_transcripts[least_time] except Exception as e: print("Exception", str(e)) pass