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

@ -40,10 +40,7 @@ public class Repository {
}
// archives files in the ingest directory
public void archiveIngest() {
File repo = new File(this.archivePath);
File[] sourceFiles = repo.listFiles();
public void archiveIngest(File[] sourceFiles) {
for (File f : sourceFiles) {
Path filePath = Path.of(f.toString());
String filename = filePath.getFileName().toString();
@ -58,10 +55,7 @@ public class Repository {
}
// clean up the ingest directory once we're done
public void cleanupIngest() {
File repo = new File(this.ingestPath);
File[] sourceFiles = repo.listFiles();
public void cleanupIngest(File[] sourceFiles) {
for (File f : sourceFiles) {
f.delete();
}