-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathSchedulerConfiguration.cs
48 lines (34 loc) · 2.11 KB
/
SchedulerConfiguration.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
using System.Text.Json.Serialization;
namespace SmartIOT.Connector.Core.Conf;
public class SchedulerConfiguration
{
public int MaxErrorsBeforeReconnection { get; set; } = 10;
public int RestartDeviceInErrorTimeoutMillis { get; set; } = (int)TimeSpan.FromSeconds(30).TotalMilliseconds;
[JsonIgnore]
public TimeSpan RestartDeviceInErrorTimeout => TimeSpan.FromMilliseconds(RestartDeviceInErrorTimeoutMillis);
public int WaitTimeAfterErrorMillis { get; set; } = (int)TimeSpan.FromSeconds(1).TotalMilliseconds;
[JsonIgnore]
public TimeSpan WaitTimeAfterError => TimeSpan.FromMilliseconds(WaitTimeAfterErrorMillis);
public int WaitTimeBetweenEveryScheduleMillis { get; set; } = 0;
[JsonIgnore]
public TimeSpan WaitTimeBetweenEverySchedule => TimeSpan.FromMilliseconds(WaitTimeBetweenEveryScheduleMillis);
public int WaitTimeBetweenReadSchedulesMillis { get; set; } = 0;
[JsonIgnore]
public TimeSpan WaitTimeBetweenReadSchedules => TimeSpan.FromMilliseconds(WaitTimeBetweenReadSchedulesMillis);
public int TerminateAfterNoWriteRequestsDelayMillis { get; set; } = 3000;
[JsonIgnore]
public TimeSpan TerminateAfterNoWriteRequestsDelay => TimeSpan.FromMilliseconds(TerminateAfterNoWriteRequestsDelayMillis);
public int TerminateMinimumDelayMillis { get; set; } = 0;
[JsonIgnore]
public TimeSpan TerminateMinimumDelay => TimeSpan.FromMilliseconds(TerminateMinimumDelayMillis);
public void CopyTo(SchedulerConfiguration configuration)
{
configuration.MaxErrorsBeforeReconnection = MaxErrorsBeforeReconnection;
configuration.RestartDeviceInErrorTimeoutMillis = RestartDeviceInErrorTimeoutMillis;
configuration.WaitTimeAfterErrorMillis = WaitTimeAfterErrorMillis;
configuration.WaitTimeBetweenEveryScheduleMillis = WaitTimeBetweenEveryScheduleMillis;
configuration.WaitTimeBetweenReadSchedulesMillis = WaitTimeBetweenReadSchedulesMillis;
configuration.TerminateAfterNoWriteRequestsDelayMillis = TerminateAfterNoWriteRequestsDelayMillis;
configuration.TerminateMinimumDelayMillis = TerminateMinimumDelayMillis;
}
}