faster shutdown, adjust download reschedule time

(cherry picked from commit ef818843185eba80fbe58786c91e2bc52994f9da)
This commit is contained in:
reusedname 2025-01-19 11:35:56 +05:00
parent 74852692d0
commit af38886f97
2 changed files with 4 additions and 2 deletions

View File

@ -728,7 +728,7 @@ public class SimplifiedLocalRecorder implements Recorder {
}
private void tryRestartRecording(Model model) {
if (!running) {
if (!running || shuttingDown) {
// recorder is not in recording state
return;
}

View File

@ -154,7 +154,7 @@ public abstract class AbstractHlsDownload extends AbstractDownload {
model.delay();
stop();
} else {
rescheduleTime = beforeLastPlaylistRequest; // try again as fast as possible
rescheduleTime = Instant.now(); // try again as fast as possible
}
} catch (EOFException e) {
// end of playlist reached
@ -422,6 +422,8 @@ public abstract class AbstractHlsDownload extends AbstractDownload {
private void calculateRescheduleTime() {
rescheduleTime = beforeLastPlaylistRequest.plusMillis(1000);
if (Instant.now().isAfter(rescheduleTime))
rescheduleTime = Instant.now();
recordingEvents.add(RecordingEvent.of("next playlist download scheduled for " + rescheduleTime.toString()));
}