Allow 3 playlist download errors before stopping a recording
This commit is contained in:
parent
a1a5fbc3a6
commit
9dde3fe842
|
@ -87,6 +87,7 @@ public abstract class AbstractHlsDownload extends AbstractDownload {
|
|||
private transient Instant afterLastPlaylistRequest= Instant.EPOCH;
|
||||
private transient Instant beforeLastPlaylistRequest= Instant.EPOCH;
|
||||
private transient int consecutivePlaylistTimeouts = 0;
|
||||
private transient int consecutivePlaylistErrors = 0;
|
||||
|
||||
protected Model model = new UnknownModel();
|
||||
|
||||
|
@ -171,8 +172,10 @@ public abstract class AbstractHlsDownload extends AbstractDownload {
|
|||
} else if (e.getResponseCode() == 403) {
|
||||
checkIfModelIsStillOnline("Playlist access forbidden (403). Model {} probably went private or offline. Model state: {}");
|
||||
} else {
|
||||
LOG.info("Playlist couldn't not be downloaded for model {}. Stopping recording", model, e);
|
||||
running = false;
|
||||
if (consecutivePlaylistErrors >= 3) {
|
||||
LOG.info("Playlist couldn't not be downloaded for model {}. Stopping recording", model, e);
|
||||
running = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -243,7 +246,9 @@ public abstract class AbstractHlsDownload extends AbstractDownload {
|
|||
byte[] bytes = body.getBytes(UTF_8);
|
||||
BandwidthMeter.add(bytes.length);
|
||||
InputStream inputStream = new ByteArrayInputStream(bytes);
|
||||
return parsePlaylist(segmentPlaylistUrl, inputStream);
|
||||
SegmentPlaylist playList = parsePlaylist(segmentPlaylistUrl, inputStream);
|
||||
consecutivePlaylistErrors = 0;
|
||||
return playList;
|
||||
} else {
|
||||
throw new HttpException(response.code(), response.message());
|
||||
}
|
||||
|
@ -251,6 +256,9 @@ public abstract class AbstractHlsDownload extends AbstractDownload {
|
|||
LOG.debug("Playlist request timed out for model {} {} time{}", model, ++consecutivePlaylistTimeouts, (consecutivePlaylistTimeouts > 1) ? 's' : "");
|
||||
// times out, return an empty playlist, so that the process can continue without wasting much more time
|
||||
throw new PlaylistTimeoutException(e);
|
||||
} catch (Exception e) {
|
||||
consecutivePlaylistErrors++;
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue