Skip to content

Commit d93986f

Browse files
committed
param
1 parent 6d66b5a commit d93986f

File tree

4 files changed

+16
-19
lines changed

4 files changed

+16
-19
lines changed

src/ScheduledTasks/Entity/Schedule.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ public void RunSchedule(TaskEntityContext context, string executionToken)
352352

353353
static DateTimeOffset? ComputeInitialRunTime(ScheduleConfiguration scheduleConfig)
354354
{
355-
if (scheduleConfig.StartImmediatelyIfLate == true &&
355+
if (scheduleConfig.StartImmediatelyIfLate &&
356356
scheduleConfig.StartAt.HasValue &&
357357
DateTimeOffset.UtcNow > scheduleConfig.StartAt.Value)
358358
{

src/ScheduledTasks/Models/ScheduleConfiguration.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,9 @@ public TimeSpan? Interval
8787
}
8888

8989
/// <summary>
90-
/// Gets or sets whether the schedule should start immediately if it's late.
90+
/// Gets or sets a value indicating whether gets or sets whether the schedule should start immediately if it's late.
9191
/// </summary>
92-
public bool? StartImmediatelyIfLate { get; set; } = false;
92+
public bool StartImmediatelyIfLate { get; set; }
9393

9494
/// <summary>
9595
/// Creates a new configuration from the provided creation options.
@@ -125,7 +125,7 @@ public HashSet<string> Update(ScheduleUpdateOptions updateOptions)
125125
updatedFields.Add(nameof(this.OrchestrationName));
126126
}
127127

128-
if (updateOptions.OrchestrationInput == null)
128+
if (!string.IsNullOrEmpty(updateOptions.OrchestrationInput))
129129
{
130130
this.OrchestrationInput = updateOptions.OrchestrationInput;
131131
updatedFields.Add(nameof(this.OrchestrationInput));

src/ScheduledTasks/Models/ScheduleCreationOptions.cs

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public record ScheduleCreationOptions
1111
/// <summary>
1212
/// The interval of the schedule.
1313
/// </summary>
14-
TimeSpan? interval;
14+
TimeSpan interval;
1515

1616
string orchestrationName = string.Empty;
1717

@@ -27,7 +27,7 @@ public string OrchestrationName
2727
/// <summary>
2828
/// Gets the ID of the schedule, if not provided, default to a new GUID.
2929
/// </summary>
30-
public string ScheduleId { get; init; } = Guid.NewGuid().ToString("N");
30+
public string ScheduleId { get; init; };
3131

3232
/// <summary>
3333
/// Gets the input to the orchestration function.
@@ -52,22 +52,19 @@ public string OrchestrationName
5252
/// <summary>
5353
/// Gets the interval of the schedule.
5454
/// </summary>
55-
public TimeSpan? Interval
55+
public TimeSpan Interval
5656
{
5757
get => this.interval;
5858
init
5959
{
60-
if (value.HasValue)
60+
if (value <= TimeSpan.Zero)
6161
{
62-
if (value.Value <= TimeSpan.Zero)
63-
{
64-
throw new ArgumentException("Interval must be positive", nameof(value));
65-
}
62+
throw new ArgumentException("Interval must be positive", nameof(value));
63+
}
6664

67-
if (value.Value.TotalSeconds < 1)
68-
{
69-
throw new ArgumentException("Interval must be at least 1 second", nameof(value));
70-
}
65+
if (value.TotalSeconds < 1)
66+
{
67+
throw new ArgumentException("Interval must be at least 1 second", nameof(value));
7168
}
7269

7370
this.interval = value;
@@ -77,5 +74,5 @@ public TimeSpan? Interval
7774
/// <summary>
7875
/// Gets a value indicating whether to start the schedule immediately if it is late. Default is false.
7976
/// </summary>
80-
public bool? StartImmediatelyIfLate { get; init; } = false;
77+
public bool StartImmediatelyIfLate { get; init; }
8178
}

src/ScheduledTasks/Models/ScheduleUpdateOptions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public TimeSpan? Interval
6161
}
6262

6363
/// <summary>
64-
/// Gets or initializes whether the schedule should start immediately if it's late. Default is false.
64+
/// Gets or initializes whether the schedule should start immediately if it's late.
6565
/// </summary>
66-
public bool? StartImmediatelyIfLate { get; init; } = false;
66+
public bool? StartImmediatelyIfLate { get; init; }
6767
}

0 commit comments

Comments
 (0)