Refactored the transcoder so that it only checks the ingest directory once before archiving, ingesting and cleaning up to avoid race conditions where it may transcode/remove a file without being archived
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
2022-05-06 16:40:28 -04:00
parent 763c27ca95
commit 5e8da26257
2 changed files with 12 additions and 18 deletions

View File

@ -32,19 +32,19 @@ public class Transcoder {
// create a periodic timer task and start it
public void run() {
// save source video files
this.repo.archiveIngest();
// transcode video files to new format
this.transcode();
// cleanup old video files in ingest
this.repo.cleanupIngest();
// pull list of files to transcode
File[] sourceFiles = this.repo.searchIngest();
// archive files
this.repo.archiveIngest(sourceFiles);
// transcode files
this.transcode(sourceFiles);
// cleanup old files
this.repo.cleanupIngest(sourceFiles);
}
// transcode files in the working directory
public void transcode() {
// search for files
File[] sourceFiles = this.repo.searchIngest();
public void transcode(File[] sourceFiles) {
// check if the ingest directory is empty
if (sourceFiles.length == 0) {
Logger.logger.info("There is nothing to transcode in ingest.");