forked from j62/ctbrec
1
0
Fork 0

Remove recordings, which fail immediately after starting

This commit is contained in:
0xboobface 2019-12-28 19:58:04 +01:00
parent e333175ecb
commit 85bacb8c04
1 changed files with 5 additions and 2 deletions

View File

@ -265,7 +265,10 @@ public class NextGenLocalRecorder implements Recorder {
}
boolean deleted = deleteIfEmpty(rec);
setRecordingStatus(rec, deleted ? State.DELETED : State.WAITING);
recordingManager.saveRecording(rec);
if (!deleted) {
// only save the status, if the recording has not been deleted, otherwise we recreate the metadata file
recordingManager.saveRecording(rec);
}
return rec;
});
} finally {
@ -276,7 +279,7 @@ public class NextGenLocalRecorder implements Recorder {
private boolean deleteIfEmpty(Recording rec) throws IOException, InvalidKeyException, NoSuchAlgorithmException {
rec.refresh();
long sizeInByte = rec.getSizeInByte();
if (sizeInByte == 0) {
if (sizeInByte <= 0) {
LOG.info("Deleting empty recording {}", rec);
delete(rec);
return true;