Fix bug, which could cause recordings to get stuck

This commit is contained in:
0xb00bface 2021-03-27 17:33:05 +01:00
parent f3c0066d93
commit dd6f41a574
2 changed files with 6 additions and 1 deletions

View File

@ -1,3 +1,7 @@
4.1.2
========================
* Fixed bug, which caused recordings to get stuck
4.1.1
========================
* Added open in browser to context menu of thumb overviews

View File

@ -150,9 +150,9 @@ public class NextGenLocalRecorder implements Recorder {
if (!future.isDone()) {
downloadFutureQueue.put(future);
} else {
downloadFutureRecordingMap.remove(future);
Recording rec = future.get();
Download d = rec.getDownload();
downloadFutureRecordingMap.remove(future);
if (d.isRunning()) {
long delay = Math.max(0, Duration.between(Instant.now(), d.getRescheduleTime()).toMillis());
ScheduledFuture<Recording> rescheduledFuture = downloadPool.schedule(rec, delay, TimeUnit.MILLISECONDS);
@ -182,6 +182,7 @@ public class NextGenLocalRecorder implements Recorder {
private void fail(ScheduledFuture<Recording> future, Exception e) {
if (downloadFutureRecordingMap.containsKey(future)) {
Recording rec = downloadFutureRecordingMap.remove(future);
deleteIfEmpty(rec);
removeRecordingProcess(rec);
rec.getDownload().finalizeDownload();
LOG.error("Error while recording stream for model {}", rec.getModel(), e);