mirror of
https://github.com/hoytech/strfry.git
synced 2025-06-15 16:13:00 +00:00
in router, ensure the configured timeout is installed for first connections
This commit is contained in:
@ -297,6 +297,20 @@ struct Router {
|
||||
try {
|
||||
auto routerConfig = loadRawTaoConfig(routerConfigFile);
|
||||
|
||||
// connectionTimeout
|
||||
|
||||
uint64_t newTimeoutUs = defaultConnectionTimeoutUs;
|
||||
if (routerConfig.get_object().contains("connectionTimeout")) {
|
||||
newTimeoutUs = routerConfig.at("connectionTimeout").get_unsigned() * 1'000'000;
|
||||
}
|
||||
|
||||
if (connectionTimeoutUs != newTimeoutUs) {
|
||||
connectionTimeoutUs = newTimeoutUs;
|
||||
LI << "Using connection timeout: " << (connectionTimeoutUs / 1'000'000) << " seconds";
|
||||
}
|
||||
|
||||
// load streamGroups
|
||||
|
||||
for (const auto &[groupName, spec] : routerConfig.at("streams").get_object()) {
|
||||
if (!streamGroups.contains(groupName)) {
|
||||
LI << "New stream group [" << groupName << "]";
|
||||
@ -314,18 +328,6 @@ struct Router {
|
||||
for (const auto &[groupName, spec] : routerConfig.at("streams").get_object()) unneededGroups.erase(groupName);
|
||||
for (const auto &groupName : unneededGroups) streamGroups.erase(groupName);
|
||||
}
|
||||
|
||||
// connectionTimeout
|
||||
|
||||
uint64_t newTimeoutUs = defaultConnectionTimeoutUs;
|
||||
if (routerConfig.get_object().contains("connectionTimeout")) {
|
||||
newTimeoutUs = routerConfig.at("connectionTimeout").get_unsigned() * 1'000'000;
|
||||
}
|
||||
|
||||
if (connectionTimeoutUs != newTimeoutUs) {
|
||||
connectionTimeoutUs = newTimeoutUs;
|
||||
LI << "Using connection timeout: " << (connectionTimeoutUs / 1'000'000) << " seconds";
|
||||
}
|
||||
} catch (std::exception &e) {
|
||||
LE << "Failed to parse router config: " << e.what();
|
||||
if (!firstConfigLoadSuccess) ::exit(1);
|
||||
|
Reference in New Issue
Block a user