Ensured clean up of uploaded file if job fails.

Previously if a job failed and it's status was set to `JobStatus.FAILED` the uploaded
file was never removed. Which was the intended design. This was an omission.

Now if the job is set to FAILED, the uploaded file will be removed correctly.
This is to ensure that uploaded files do not persist in perpetuity on the file system.

FileMetadata will still be available in the DB (B.N. not the actual file).
This commit is contained in:
Nico Athanassiadis 2025-02-04 06:39:07 +01:00
parent 03f8f6bfaa
commit cced346d3b

@ -95,6 +95,7 @@ public class JobProcessorService {
logger.info("Transcription failed for file: {}", managedJob.getFileName());
managedJob.setJobStatus(JobStatus.FAILED);
fileMetadataRepository.saveAndFlush(managedJob);
cleanupFile(managedJob);
break;
}
} catch (ObjectOptimisticLockingFailureException e) {