aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/slskd/Core/Options.cs52
1 files changed, 52 insertions, 0 deletions
diff --git a/src/slskd/Core/Options.cs b/src/slskd/Core/Options.cs
index 68fa4d92..53c94303 100644
--- a/src/slskd/Core/Options.cs
+++ b/src/slskd/Core/Options.cs
@@ -283,6 +283,12 @@ namespace slskd
public RetentionOptions Retention { get; init; } = new RetentionOptions();
/// <summary>
+ /// Gets throttling options.
+ /// </summary>
+ [Validate]
+ public ThrottlingOptions Throttling { get; init; } = new ThrottlingOptions();
+
+ /// <summary>
/// Gets logger options.
/// </summary>
[Validate]
@@ -1462,6 +1468,52 @@ namespace slskd
}
/// <summary>
+ /// Throttling options.
+ /// </summary>
+ public class ThrottlingOptions
+ {
+ /// <summary>
+ /// Gets search throttling options.
+ /// </summary>
+ [Validate]
+ public SearchThrottlingOptions Search { get; init; } = new SearchThrottlingOptions();
+
+ /// <summary>
+ /// Search throttling options.
+ /// </summary>
+ public class SearchThrottlingOptions
+ {
+ /// <summary>
+ /// Gets search response throttling options.
+ /// </summary>
+ [Validate]
+ public SearchResponseThrottlingOptions Response { get; init; } = new SearchResponseThrottlingOptions();
+
+ /// <summary>
+ /// Search response throttling options.
+ /// </summary>
+ public class SearchResponseThrottlingOptions
+ {
+ /// <summary>
+ /// Gets the limit for the number of concurrent search response operations.
+ /// </summary>
+ [EnvironmentVariable("THROTTLING_SEARCH_RESPONSE_CONCURRENCY")]
+ [Range(1, 100)]
+ [RequiresRestart]
+ public int Concurrency { get; init; } = 10;
+
+ /// <summary>
+ /// Gets the limit for the number of queued search response operations, after which requests will be discarded.
+ /// </summary>
+ [EnvironmentVariable("THROTTLING_SEARCH_RESPONSE_CIRCUIT_BREAKER")]
+ [Range(100, 10000)]
+ [RequiresRestart]
+ public int CircuitBreaker { get; init; } = 500;
+ }
+ }
+ }
+
+ /// <summary>
/// Metrics options.
/// </summary>
public class MetricsOptions