Stop download if the playlist request timed out 5 times

This commit is contained in:
0xb00bface 2021-01-24 13:36:51 +01:00
parent 10321f32bd
commit e789ce2029
1 changed files with 9 additions and 3 deletions

View File

@ -132,7 +132,11 @@ public abstract class AbstractHlsDownload extends AbstractDownload {
LOG.error("Couldn't parse HLS playlist for model {}", model, e); LOG.error("Couldn't parse HLS playlist for model {}", model, e);
stop(); stop();
} catch (PlaylistTimeoutException e) { } catch (PlaylistTimeoutException e) {
rescheduleTime = beforeLastPlaylistRequest; // try again as fast as possible if (consecutivePlaylistTimeouts >= 5) {
stop();
} else {
rescheduleTime = beforeLastPlaylistRequest; // try again as fast as possible
}
} catch (EOFException e) { } catch (EOFException e) {
// end of playlist reached // end of playlist reached
LOG.debug("Reached end of playlist for model {}", model); LOG.debug("Reached end of playlist for model {}", model);
@ -179,10 +183,12 @@ public abstract class AbstractHlsDownload extends AbstractDownload {
ctbrec.Model.State modelState; ctbrec.Model.State modelState;
try { try {
modelState = model.getOnlineState(false); modelState = model.getOnlineState(false);
if (modelState != State.ONLINE) { if (modelState == State.ONLINE) {
segmentPlaylistUrl = getSegmentPlaylistUrl(model);
} else {
stop(); stop();
} }
} catch (ExecutionException e1) { } catch (Exception e1) {
modelState = State.UNKNOWN; modelState = State.UNKNOWN;
} }
LOG.info(errorMsg, model, modelState); LOG.info(errorMsg, model, modelState);