From 3779cc3d88ffa65ce312588cccc602a5fbe341f4 Mon Sep 17 00:00:00 2001 From: Marcel Klehr Date: Mon, 17 Apr 2023 14:49:20 +0200 Subject: [PATCH] SpeechToTextManager: Deduplicate transcription jobs Signed-off-by: Marcel Klehr --- lib/private/SpeechToText/SpeechToTextManager.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/private/SpeechToText/SpeechToTextManager.php b/lib/private/SpeechToText/SpeechToTextManager.php index 0c41c3cb600..93a74711e32 100644 --- a/lib/private/SpeechToText/SpeechToTextManager.php +++ b/lib/private/SpeechToText/SpeechToTextManager.php @@ -94,6 +94,9 @@ class SpeechToTextManager implements ISpeechToTextManager { throw new PreConditionNotMetException('No SpeechToText providers have been registered'); } try { + if ($this->jobList->has(TranscriptionJob::class, ['fileId' => $file->getId()])) { + return; + } $this->jobList->add(TranscriptionJob::class, ['fileId' => $file->getId()]); } catch (NotFoundException|InvalidPathException $e) { throw new InvalidArgumentException('Invalid file provided for file transcription: ' . $e->getMessage());