40 lines
1012 B
C#
40 lines
1012 B
C#
namespace ScrapperAPI.Options;
|
|
|
|
public enum DistributedMode
|
|
{
|
|
LocalOnly = 0,
|
|
Hybrid = 1,
|
|
PreferAgents = 2,
|
|
PreferLocal = 3
|
|
}
|
|
|
|
public sealed class WorkerOptions
|
|
{
|
|
public DistributedMode Mode { get; set; } = DistributedMode.Hybrid;
|
|
|
|
/// <summary>
|
|
/// Lease duration for a queue item before it can be recovered by another worker.
|
|
/// </summary>
|
|
public int LeaseSeconds { get; set; } = 120;
|
|
|
|
public LocalWorkerOptions Local { get; set; } = new();
|
|
public AgentOptions Agents { get; set; } = new();
|
|
}
|
|
|
|
public sealed class LocalWorkerOptions
|
|
{
|
|
public bool Enabled { get; set; } = true;
|
|
public int Concurrency { get; set; } = 1;
|
|
|
|
/// <summary>
|
|
/// When Mode=PreferAgents, local worker will run only if no agent was seen within this window.
|
|
/// </summary>
|
|
public int PreferAgentsGraceSeconds { get; set; } = 30;
|
|
}
|
|
|
|
public sealed class AgentOptions
|
|
{
|
|
public bool Enabled { get; set; } = true;
|
|
public bool RequireMutualTls { get; set; } = true;
|
|
}
|