SpeechToTextManager: Deduplicate transcription jobs

Signed-off-by: Marcel Klehr <mklehr@gmx.net>
This commit is contained in:
Marcel Klehr 2023-04-17 14:49:20 +02:00
parent ad1a0d88ef
commit 3779cc3d88

View file

@ -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());