Fix zombie recordings
received data check was being skipped due to exceptions
This commit is contained in:
parent
466d705131
commit
5cadac31ce
|
@ -136,11 +136,6 @@ public abstract class AbstractHlsDownload extends AbstractDownload {
|
||||||
recordingEvents.remove(0);
|
recordingEvents.remove(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Duration.between(lastSegmentDownload, Instant.now()).getSeconds() > MAX_SECONDS_WITHOUT_TRANSFER) {
|
|
||||||
LOG.info("No video data received for {} seconds. Stopping recording for model {}", MAX_SECONDS_WITHOUT_TRANSFER, model);
|
|
||||||
stop();
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
} catch (ParseException e) {
|
} catch (ParseException e) {
|
||||||
LOG.error("Couldn't parse HLS playlist for model {}\n{}", model, e.getInput(), e);
|
LOG.error("Couldn't parse HLS playlist for model {}\n{}", model, e.getInput(), e);
|
||||||
model.delay();
|
model.delay();
|
||||||
|
@ -167,11 +162,17 @@ public abstract class AbstractHlsDownload extends AbstractDownload {
|
||||||
LOG.error("Couldn't download segment for model {}", model, e);
|
LOG.error("Couldn't download segment for model {}", model, e);
|
||||||
model.delay();
|
model.delay();
|
||||||
stop();
|
stop();
|
||||||
} finally {
|
} finally {
|
||||||
if (consecutivePlaylistErrors > 0) {
|
if (consecutivePlaylistErrors > 0) {
|
||||||
LOG.debug("Consecutive playlist errors: {}", consecutivePlaylistErrors);
|
LOG.debug("Consecutive playlist errors: {}", consecutivePlaylistErrors);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Duration.between(lastSegmentDownload, Instant.now()).getSeconds() > MAX_SECONDS_WITHOUT_TRANSFER) {
|
||||||
|
LOG.info("No video data received for {} seconds. Stopping recording for model {}", MAX_SECONDS_WITHOUT_TRANSFER, model);
|
||||||
|
stop();
|
||||||
|
}
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -280,7 +281,7 @@ public abstract class AbstractHlsDownload extends AbstractDownload {
|
||||||
Builder builder = new Request.Builder().url(segmentsUrl);
|
Builder builder = new Request.Builder().url(segmentsUrl);
|
||||||
addHeaders(builder, Optional.ofNullable(model).map(Model::getHttpHeaderFactory).map(HttpHeaderFactory::createSegmentPlaylistHeaders).orElse(new HashMap<>()), model);
|
addHeaders(builder, Optional.ofNullable(model).map(Model::getHttpHeaderFactory).map(HttpHeaderFactory::createSegmentPlaylistHeaders).orElse(new HashMap<>()), model);
|
||||||
Request request = builder.build();
|
Request request = builder.build();
|
||||||
|
|
||||||
try (Response response = client.execute(request, config.getSettings().playlistRequestTimeout)) {
|
try (Response response = client.execute(request, config.getSettings().playlistRequestTimeout)) {
|
||||||
if (response.isSuccessful()) {
|
if (response.isSuccessful()) {
|
||||||
consecutivePlaylistTimeouts = 0;
|
consecutivePlaylistTimeouts = 0;
|
||||||
|
@ -302,16 +303,21 @@ public abstract class AbstractHlsDownload extends AbstractDownload {
|
||||||
recordingEvents.add(RecordingEvent.of("HTTP code " + response.code()));
|
recordingEvents.add(RecordingEvent.of("HTTP code " + response.code()));
|
||||||
throw new HttpException(response.code(), response.message());
|
throw new HttpException(response.code(), response.message());
|
||||||
}
|
}
|
||||||
} catch (SocketTimeoutException e) {
|
} catch (SocketTimeoutException e) {
|
||||||
LOG.debug("Playlist request timed out ({}ms) for model {}:{} {} time{}", config.getSettings().playlistRequestTimeout, model.getSite().getName(), model,
|
LOG.debug("Playlist request timed out ({}ms) for model {}:{} {} time{} (took {}ms)",
|
||||||
++consecutivePlaylistTimeouts, (consecutivePlaylistTimeouts > 1) ? 's' : "");
|
config.getSettings().playlistRequestTimeout,
|
||||||
|
model.getSite().getName(),
|
||||||
|
model,
|
||||||
|
++consecutivePlaylistTimeouts,
|
||||||
|
(consecutivePlaylistTimeouts > 1) ? 's' : "",
|
||||||
|
(Duration.between(start, Instant.now()).toMillis()));
|
||||||
// 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
|
||||||
recordingEvents.add(RecordingEvent.of("Playlist request timed out " + consecutivePlaylistTimeouts));
|
recordingEvents.add(RecordingEvent.of("Playlist request timed out " + consecutivePlaylistTimeouts));
|
||||||
throw new PlaylistTimeoutException(e);
|
throw new PlaylistTimeoutException(e);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
consecutivePlaylistErrors++;
|
consecutivePlaylistErrors++;
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private SegmentPlaylist parsePlaylist(String segmentPlaylistUrl, InputStream inputStream) throws IOException, ParseException, PlaylistException {
|
private SegmentPlaylist parsePlaylist(String segmentPlaylistUrl, InputStream inputStream) throws IOException, ParseException, PlaylistException {
|
||||||
|
|
Loading…
Reference in New Issue