forked from j62/ctbrec
faster shutdown, adjust download reschedule time
(cherry picked from commit ef818843185eba80fbe58786c91e2bc52994f9da)
This commit is contained in:
parent
74852692d0
commit
af38886f97
|
@ -728,7 +728,7 @@ public class SimplifiedLocalRecorder implements Recorder {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void tryRestartRecording(Model model) {
|
private void tryRestartRecording(Model model) {
|
||||||
if (!running) {
|
if (!running || shuttingDown) {
|
||||||
// recorder is not in recording state
|
// recorder is not in recording state
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -154,7 +154,7 @@ public abstract class AbstractHlsDownload extends AbstractDownload {
|
||||||
model.delay();
|
model.delay();
|
||||||
stop();
|
stop();
|
||||||
} else {
|
} else {
|
||||||
rescheduleTime = beforeLastPlaylistRequest; // try again as fast as possible
|
rescheduleTime = Instant.now(); // try again as fast as possible
|
||||||
}
|
}
|
||||||
} catch (EOFException e) {
|
} catch (EOFException e) {
|
||||||
// end of playlist reached
|
// end of playlist reached
|
||||||
|
@ -422,6 +422,8 @@ public abstract class AbstractHlsDownload extends AbstractDownload {
|
||||||
|
|
||||||
private void calculateRescheduleTime() {
|
private void calculateRescheduleTime() {
|
||||||
rescheduleTime = beforeLastPlaylistRequest.plusMillis(1000);
|
rescheduleTime = beforeLastPlaylistRequest.plusMillis(1000);
|
||||||
|
if (Instant.now().isAfter(rescheduleTime))
|
||||||
|
rescheduleTime = Instant.now();
|
||||||
recordingEvents.add(RecordingEvent.of("next playlist download scheduled for " + rescheduleTime.toString()));
|
recordingEvents.add(RecordingEvent.of("next playlist download scheduled for " + rescheduleTime.toString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue