Skip to content

Commit

Permalink
Only sleep if the queue is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
hauck-jvsh committed Jul 8, 2024
1 parent 72ab684 commit 6e3f1a2
Showing 1 changed file with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -576,8 +576,20 @@ private static void startTrancribeThreads(AbstractTranscriptTask task) {
@Override
public void run() {
while (true) {
Boolean empty=true;
synchronized (toTranscribe) {
empty=toTranscribe.isEmpty();
}
if(empty) {
try {
Thread.sleep(100);

}catch (Exception e) {
// TODO: handle exception
}
continue;
}
try {
Thread.sleep(100);
transcriptSemaphore.acquire();
transcribeAudios(task);

Expand Down

0 comments on commit 6e3f1a2

Please sign in to comment.