Class PollingSettingsWorkerConfiguration
- Namespace
- OpenSettings.Configurations
- Assembly
- OpenSettings.dll
Represents a worker that handles polling for the latest settings within a specified period.
This class allows you to configure the initial wait time before starting the polling, the interval at which the polling occurs, and whether the worker is currently active.
It also validates the input for time spans and sets default values if none are provided.
public class PollingSettingsWorkerConfiguration
- Inheritance
-
PollingSettingsWorkerConfiguration
- Inherited Members
Constructors
PollingSettingsWorkerConfiguration(bool, string, string)
Initializes a new instance of the PollingSettingsWorkerConfiguration class.
This constructor takes parameters to set the initial wait time, polling interval, and the active state of the worker.
[JsonConstructor]
public PollingSettingsWorkerConfiguration(bool isActive = false, string startsIn = null, string period = null)
Parameters
isActive
boolIndicates whether the polling worker is active.
startsIn
stringThe time span to wait before starting the polling. Defaults to 5 minutes if not specified.
period
stringThe time span between polling period. Defaults to 5 minutes if not specified.
Exceptions
- FormatException
Thrown when the format of the
startsIn
orperiod
parameters is incorrect.
PollingSettingsWorkerConfiguration(bool, TimeSpan, TimeSpan)
public PollingSettingsWorkerConfiguration(bool isActive, TimeSpan startsIn, TimeSpan period)
Parameters
Properties
IsActive
Gets a value indicating whether the polling worker is active.
If true, the worker is actively polling at the specified intervals; otherwise, it is paused.
public bool IsActive { get; }
Property Value
Period
Gets the time span between each polling interval.
This value specifies how frequently the worker should poll for updates.
public TimeSpan Period { get; }
Property Value
StartsIn
Gets the time span to wait before starting the first polling.
This value determines how long the worker will wait before initiating the first polling process.
public TimeSpan StartsIn { get; }