Add setting for playlist request timeout
This commit is contained in:
parent
844295101e
commit
f646c28151
|
@ -135,6 +135,7 @@ public class SettingsTab extends Tab implements TabSelectionListener {
|
|||
private SimpleIntegerProperty postProcessingThreads;
|
||||
private IgnoreList ignoreList;
|
||||
private Label restartNotification;
|
||||
private SimpleIntegerProperty playlistRequestTimeout;
|
||||
|
||||
public SettingsTab(List<Site> sites, Recorder recorder) {
|
||||
this.sites = sites;
|
||||
|
@ -193,6 +194,7 @@ public class SettingsTab extends Tab implements TabSelectionListener {
|
|||
useHlsdl = new SimpleBooleanProperty(null, "useHlsdl", settings.useHlsdl);
|
||||
hlsdlExecutable = new SimpleFileProperty(null, "hlsdlExecutable", settings.hlsdlExecutable);
|
||||
recentlyWatched = new SimpleBooleanProperty(null, "recentlyWatched", settings.recentlyWatched);
|
||||
playlistRequestTimeout = new SimpleIntegerProperty(null, "playlistRequestTimeout", settings.playlistRequestTimeout);
|
||||
}
|
||||
|
||||
private void createGui() {
|
||||
|
@ -277,6 +279,9 @@ public class SettingsTab extends Tab implements TabSelectionListener {
|
|||
)
|
||||
),
|
||||
Category.of("Advanced / Devtools",
|
||||
Group.of("Networking",
|
||||
Setting.of("Playlist request timeout (ms)", playlistRequestTimeout, "Timeout in ms for playlist requests")
|
||||
),
|
||||
Group.of("Logging",
|
||||
Setting.of("Log FFmpeg output", logFFmpegOutput, "Log FFmpeg output to files in the system's temp directory")
|
||||
),
|
||||
|
|
|
@ -113,6 +113,7 @@ public class Settings {
|
|||
public String password = "";
|
||||
@Deprecated
|
||||
public String postProcessing = "";
|
||||
public int playlistRequestTimeout = 2000;
|
||||
public int postProcessingThreads = 2;
|
||||
public List<PostProcessor> postProcessors = new ArrayList<>();
|
||||
public String proxyHost;
|
||||
|
|
|
@ -230,7 +230,7 @@ public abstract class AbstractHlsDownload extends AbstractDownload {
|
|||
addHeaders(builder, Optional.ofNullable(model).map(Model::getHttpHeaderFactory).map(HttpHeaderFactory::createSegmentPlaylistHeaders).orElse(new HashMap<>()), model);
|
||||
Request request = builder.build();
|
||||
|
||||
try (Response response = client.execute(request, 2000)) {
|
||||
try (Response response = client.execute(request, config.getSettings().playlistRequestTimeout)) {
|
||||
if (response.isSuccessful()) {
|
||||
consecutivePlaylistTimeouts = 0;
|
||||
String body = response.body().string();
|
||||
|
@ -253,7 +253,8 @@ public abstract class AbstractHlsDownload extends AbstractDownload {
|
|||
throw new HttpException(response.code(), response.message());
|
||||
}
|
||||
} catch (SocketTimeoutException e) {
|
||||
LOG.debug("Playlist request timed out for model {} {} time{}", model, ++consecutivePlaylistTimeouts, (consecutivePlaylistTimeouts > 1) ? 's' : "");
|
||||
LOG.debug("Playlist request timed out ({}ms) for model {} {} time{}", config.getSettings().playlistRequestTimeout, model,
|
||||
++consecutivePlaylistTimeouts, (consecutivePlaylistTimeouts > 1) ? 's' : "");
|
||||
// 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));
|
||||
throw new PlaylistTimeoutException(e);
|
||||
|
|
Loading…
Reference in New Issue