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 afterLastPlaylistRequest= Instant.EPOCH;
|
||||||
private transient Instant beforeLastPlaylistRequest= Instant.EPOCH;
|
private transient Instant beforeLastPlaylistRequest= Instant.EPOCH;
|
||||||
private transient int consecutivePlaylistTimeouts = 0;
|
private transient int consecutivePlaylistTimeouts = 0;
|
||||||
|
private transient int consecutivePlaylistErrors = 0;
|
||||||
|
|
||||||
protected Model model = new UnknownModel();
|
protected Model model = new UnknownModel();
|
||||||
|
|
||||||
|
@ -171,8 +172,10 @@ public abstract class AbstractHlsDownload extends AbstractDownload {
|
||||||
} else if (e.getResponseCode() == 403) {
|
} else if (e.getResponseCode() == 403) {
|
||||||
checkIfModelIsStillOnline("Playlist access forbidden (403). Model {} probably went private or offline. Model state: {}");
|
checkIfModelIsStillOnline("Playlist access forbidden (403). Model {} probably went private or offline. Model state: {}");
|
||||||
} else {
|
} else {
|
||||||
LOG.info("Playlist couldn't not be downloaded for model {}. Stopping recording", model, e);
|
if (consecutivePlaylistErrors >= 3) {
|
||||||
running = false;
|
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);
|
byte[] bytes = body.getBytes(UTF_8);
|
||||||
BandwidthMeter.add(bytes.length);
|
BandwidthMeter.add(bytes.length);
|
||||||
InputStream inputStream = new ByteArrayInputStream(bytes);
|
InputStream inputStream = new ByteArrayInputStream(bytes);
|
||||||
return parsePlaylist(segmentPlaylistUrl, inputStream);
|
SegmentPlaylist playList = parsePlaylist(segmentPlaylistUrl, inputStream);
|
||||||
|
consecutivePlaylistErrors = 0;
|
||||||
|
return playList;
|
||||||
} else {
|
} else {
|
||||||
throw new HttpException(response.code(), response.message());
|
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' : "");
|
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
|
// times out, return an empty playlist, so that the process can continue without wasting much more time
|
||||||
throw new PlaylistTimeoutException(e);
|
throw new PlaylistTimeoutException(e);
|
||||||
|
} catch (Exception e) {
|
||||||
|
consecutivePlaylistErrors++;
|
||||||
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue