New settings, reduce config saving spam
- max concurrent http requests (total and per host) - config saving is delayed for some millis to reduce disk and log spam in case of fast repeated calls
This commit is contained in:
parent
d07a9ffaaa
commit
db13cd09cc
|
@ -135,6 +135,9 @@ public class SettingsTab extends Tab implements TabSelectionListener {
|
||||||
private SimpleStringProperty filterWhitelist;
|
private SimpleStringProperty filterWhitelist;
|
||||||
private SimpleBooleanProperty deleteOrphanedRecordingMetadata;
|
private SimpleBooleanProperty deleteOrphanedRecordingMetadata;
|
||||||
private SimpleIntegerProperty restrictBitrate;
|
private SimpleIntegerProperty restrictBitrate;
|
||||||
|
private SimpleIntegerProperty configSavingDelayMs;
|
||||||
|
private SimpleIntegerProperty httpClientMaxRequests;
|
||||||
|
private SimpleIntegerProperty httpClientMaxRequestsPerHost;
|
||||||
|
|
||||||
public SettingsTab(List<Site> sites, Recorder recorder) {
|
public SettingsTab(List<Site> sites, Recorder recorder) {
|
||||||
this.sites = sites;
|
this.sites = sites;
|
||||||
|
@ -219,6 +222,9 @@ public class SettingsTab extends Tab implements TabSelectionListener {
|
||||||
filterWhitelist = new SimpleStringProperty(null, "filterWhitelist", settings.filterWhitelist);
|
filterWhitelist = new SimpleStringProperty(null, "filterWhitelist", settings.filterWhitelist);
|
||||||
deleteOrphanedRecordingMetadata = new SimpleBooleanProperty(null, "deleteOrphanedRecordingMetadata", settings.deleteOrphanedRecordingMetadata);
|
deleteOrphanedRecordingMetadata = new SimpleBooleanProperty(null, "deleteOrphanedRecordingMetadata", settings.deleteOrphanedRecordingMetadata);
|
||||||
restrictBitrate = new SimpleIntegerProperty(null, "restrictBitrate", settings.restrictBitrate);
|
restrictBitrate = new SimpleIntegerProperty(null, "restrictBitrate", settings.restrictBitrate);
|
||||||
|
configSavingDelayMs = new SimpleIntegerProperty(null, "configSavingDelayMs", settings.configSavingDelayMs);
|
||||||
|
httpClientMaxRequests = new SimpleIntegerProperty(null, "httpClientMaxRequests", settings.httpClientMaxRequests);
|
||||||
|
httpClientMaxRequestsPerHost = new SimpleIntegerProperty(null, "httpClientMaxRequestsPerHost", settings.httpClientMaxRequestsPerHost);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createGui() {
|
private void createGui() {
|
||||||
|
@ -332,7 +338,17 @@ public class SettingsTab extends Tab implements TabSelectionListener {
|
||||||
Setting.of("Password", proxyPassword).needsRestart())),
|
Setting.of("Password", proxyPassword).needsRestart())),
|
||||||
Category.of("Advanced / Devtools",
|
Category.of("Advanced / Devtools",
|
||||||
Group.of("Networking",
|
Group.of("Networking",
|
||||||
Setting.of("Playlist request timeout (ms)", playlistRequestTimeout, "Timeout in ms for playlist requests")),
|
Setting.of("Playlist request timeout (ms)", playlistRequestTimeout, "Timeout in ms for playlist requests"),
|
||||||
|
Setting.of("Max requests", httpClientMaxRequests,
|
||||||
|
"The maximum number of requests to execute concurrently. Above this requests queue in memory,\n" + //
|
||||||
|
"waiting for the running calls to complete.\n\n" + //
|
||||||
|
"If more than [maxRequests] requests are in flight when this is invoked, those requests will remain in flight."),
|
||||||
|
Setting.of("Max requests per host", httpClientMaxRequestsPerHost,
|
||||||
|
"The maximum number of requests for each host to execute concurrently. This limits requests by\n" + //
|
||||||
|
"the URL's host name. Note that concurrent requests to a single IP address may still exceed this\n" + //
|
||||||
|
"limit: multiple hostnames may share an IP address or be routed through the same HTTP proxy.\n\n" + //
|
||||||
|
"If more than [maxRequestsPerHost] requests are in flight when this is invoked, those requests will remain in flight.\n\n" + //
|
||||||
|
"WebSocket connections to hosts **do not** count against this limit.")),
|
||||||
Group.of("Logging",
|
Group.of("Logging",
|
||||||
Setting.of("Log FFmpeg output", logFFmpegOutput, "Log FFmpeg output to files in the system's temp directory"),
|
Setting.of("Log FFmpeg output", logFFmpegOutput, "Log FFmpeg output to files in the system's temp directory"),
|
||||||
Setting.of("Log missed segments", logMissedSegments,
|
Setting.of("Log missed segments", logMissedSegments,
|
||||||
|
@ -341,7 +357,10 @@ public class SettingsTab extends Tab implements TabSelectionListener {
|
||||||
Setting.of("Use hlsdl (if possible)", useHlsdl,
|
Setting.of("Use hlsdl (if possible)", useHlsdl,
|
||||||
"Use hlsdl to record the live streams. Some features might not work correctly."),
|
"Use hlsdl to record the live streams. Some features might not work correctly."),
|
||||||
Setting.of("hlsdl executable", hlsdlExecutable, "Path to the hlsdl executable"),
|
Setting.of("hlsdl executable", hlsdlExecutable, "Path to the hlsdl executable"),
|
||||||
Setting.of("Log hlsdl output", loghlsdlOutput, "Log hlsdl output to files in the system's temp directory"))));
|
Setting.of("Log hlsdl output", loghlsdlOutput, "Log hlsdl output to files in the system's temp directory")),
|
||||||
|
Group.of("Miscelaneous",
|
||||||
|
Setting.of("Config file saving delay (ms)", configSavingDelayMs,
|
||||||
|
"Wait specified number of milliseconds before actually writing config to disk"))));
|
||||||
Region preferencesView = prefs.getView();
|
Region preferencesView = prefs.getView();
|
||||||
prefs.onRestartRequired(this::showRestartRequired);
|
prefs.onRestartRequired(this::showRestartRequired);
|
||||||
storage.setPreferences(prefs);
|
storage.setPreferences(prefs);
|
||||||
|
|
|
@ -143,6 +143,8 @@ public class Settings {
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public String postProcessing = "";
|
public String postProcessing = "";
|
||||||
public int playlistRequestTimeout = 2000;
|
public int playlistRequestTimeout = 2000;
|
||||||
|
public int httpClientMaxRequests = 64;
|
||||||
|
public int httpClientMaxRequestsPerHost = 16;
|
||||||
public int postProcessingThreads = 2;
|
public int postProcessingThreads = 2;
|
||||||
public List<PostProcessorDto> postProcessors = new ArrayList<>();
|
public List<PostProcessorDto> postProcessors = new ArrayList<>();
|
||||||
public String proxyHost;
|
public String proxyHost;
|
||||||
|
@ -228,4 +230,5 @@ public class Settings {
|
||||||
public String filterWhitelist = "";
|
public String filterWhitelist = "";
|
||||||
public boolean checkResolutionByMinSide = false;
|
public boolean checkResolutionByMinSide = false;
|
||||||
public int restrictBitrate = 0;
|
public int restrictBitrate = 0;
|
||||||
|
public int configSavingDelayMs = 400;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,7 @@ import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.Authenticator;
|
import java.net.Authenticator;
|
||||||
import java.net.PasswordAuthentication;
|
import java.net.PasswordAuthentication;
|
||||||
|
import java.net.SocketTimeoutException;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.security.KeyManagementException;
|
import java.security.KeyManagementException;
|
||||||
import java.security.NoSuchAlgorithmException;
|
import java.security.NoSuchAlgorithmException;
|
||||||
|
@ -171,6 +172,8 @@ public abstract class HttpClient {
|
||||||
}
|
}
|
||||||
|
|
||||||
client = builder.build();
|
client = builder.build();
|
||||||
|
client.dispatcher().setMaxRequests(config.getSettings().httpClientMaxRequests);
|
||||||
|
client.dispatcher().setMaxRequestsPerHost(config.getSettings().httpClientMaxRequestsPerHost);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -580,7 +580,7 @@ public class SimplifiedLocalRecorder implements Recorder {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
saveConfigTimer.schedule(saveConfigTask, 400);
|
saveConfigTimer.schedule(saveConfigTask, config.getSettings().configSavingDelayMs);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue