Skip to content

Usenet streaming with a WebDAV server and a SABnzbd-compatible API

C#

Removed max-queue-connections and max-repair-connections settings.

nzbdav-devaa3d31d91498
diff --git a/backend/Config/ConfigManager.cs b/backend/Config/ConfigManager.cs
index 502dc5f8..2d191687 100644
--- a/backend/Config/ConfigManager.cs
+++ b/backend/Config/ConfigManager.cs
@@ -132,14 +132,6 @@ public class ConfigManager
return StringUtil.EmptyToNull(GetConfigValue("media.library-dir"));
}
- public int GetMaxQueueConnections()
- {
- return int.Parse(
- StringUtil.EmptyToNull(GetConfigValue("api.max-queue-connections"))
- ?? GetUsenetProviderConfig().TotalPooledConnections.ToString()
- );
- }
-
public int GetMaxDownloadConnections()
{
return int.Parse(
@@ -183,21 +175,12 @@ public class ConfigManager
return (configValue != null ? bool.Parse(configValue) : defaultValue);
}
- public int GetMaxRepairConnections()
- {
- return int.Parse(
- StringUtil.EmptyToNull(GetConfigValue("repair.connections"))
- ?? GetUsenetProviderConfig().TotalPooledConnections.ToString()
- );
- }
-
public bool IsRepairJobEnabled()
{
var defaultValue = false;
var configValue = StringUtil.EmptyToNull(GetConfigValue("repair.enable"));
var isRepairJobEnabled = (configValue != null ? bool.Parse(configValue) : defaultValue);
return isRepairJobEnabled
- && GetMaxRepairConnections() > 0
&& GetLibraryDir() != null
&& GetArrConfig().GetInstanceCount() > 0;
}
diff --git a/backend/Queue/DeobfuscationSteps/1.FetchFirstSegment/FetchFirstSegmentsStep.cs b/backend/Queue/DeobfuscationSteps/1.FetchFirstSegment/FetchFirstSegmentsStep.cs
index 40939257..2ce589aa 100644
--- a/backend/Queue/DeobfuscationSteps/1.FetchFirstSegment/FetchFirstSegmentsStep.cs
+++ b/backend/Queue/DeobfuscationSteps/1.FetchFirstSegment/FetchFirstSegmentsStep.cs
@@ -23,7 +23,7 @@ public static class FetchFirstSegmentsStep
return await nzbFiles
.Where(x => x.Segments.Count > 0)
.Select(x => FetchFirstSegment(x, usenetClient, cancellationToken))
- .WithConcurrencyAsync(configManager.GetMaxQueueConnections())
+ .WithConcurrencyAsync(configManager.GetMaxDownloadConnections())
.GetAllAsync(cancellationToken, progress).ConfigureAwait(false);
}
diff --git a/backend/Queue/QueueItemProcessor.cs b/backend/Queue/QueueItemProcessor.cs
index 6b4987a5..d1acbe42 100644
--- a/backend/Queue/QueueItemProcessor.cs
+++ b/backend/Queue/QueueItemProcessor.cs
@@ -106,9 +106,6 @@ public class QueueItemProcessor(
return;
}
- // ensure we don't use more than max-queue-connections
- var concurrency = configManager.GetMaxQueueConnections();
-
// read the nzb document
var documentBytes = Encoding.UTF8.GetBytes(queueNzbContents.NzbContents);
using var stream = new MemoryStream(documentBytes);
@@ -140,7 +137,7 @@ public class QueueItemProcessor(
.ToPercentage(fileProcessors.Count);
var fileProcessingResultsAll = await fileProcessors
.Select(x => x!.ProcessAsync())
- .WithConcurrencyAsync(concurrency)
+ .WithConcurrencyAsync(configManager.GetMaxDownloadConnections())
.GetAllAsync(ct, part2Progress).ConfigureAwait(false);
var fileProcessingResults = fileProcessingResultsAll
.Where(x => x is not null)
@@ -158,7 +155,12 @@ public class QueueItemProcessor(
var part3Progress = progress
.Offset(100)
.ToPercentage(articlesToCheck.Count);
- await usenetClient.CheckAllSegmentsAsync(articlesToCheck, concurrency, part3Progress, ct).ConfigureAwait(false);
+ var healthCheckConcurrency = configManager
+ .GetUsenetProviderConfig()
+ .TotalPooledConnections;
+ await usenetClient
+ .CheckAllSegmentsAsync(articlesToCheck, healthCheckConcurrency, part3Progress, ct)
+ .ConfigureAwait(false);
checkedFullHealth = true;
}
diff --git a/backend/Services/HealthCheckService.cs b/backend/Services/HealthCheckService.cs
index 77e9cad9..8cb2f304 100644
--- a/backend/Services/HealthCheckService.cs
+++ b/backend/Services/HealthCheckService.cs
@@ -58,7 +58,7 @@ public class HealthCheckService
}
// get concurrency
- var concurrency = _configManager.GetMaxRepairConnections();
+ var concurrency = _configManager.GetUsenetProviderConfig().TotalPooledConnections;
using var cts = CancellationTokenSource.CreateLinkedTokenSource(_cancellationToken);
// get the davItem to health-check