Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions src/Orleans.Reminders/ReminderService/ReminderRegistry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,19 @@ public ReminderRegistry(IServiceProvider serviceProvider, IOptions<ReminderOptio

public Task<IGrainReminder> RegisterOrUpdateReminder(GrainId callingGrainId, string reminderName, TimeSpan dueTime, TimeSpan period)
{
// Perform input volatility checks that are consistent with System.Threading.Timer
// http://referencesource.microsoft.com/#mscorlib/system/threading/timer.cs,c454f2afe745d4d3,references
if (dueTime.Ticks < 0 && dueTime != Timeout.InfiniteTimeSpan)
// Perform input volatility checks
if (dueTime == Timeout.InfiniteTimeSpan)
throw new ArgumentOutOfRangeException(nameof(dueTime), "Cannot use InfiniteTimeSpan dueTime to create a reminder");

if (dueTime.Ticks < 0)
throw new ArgumentOutOfRangeException(nameof(dueTime), "Cannot use negative dueTime to create a reminder");

if (period.Ticks < 0 && period != Timeout.InfiniteTimeSpan)

if (period == Timeout.InfiniteTimeSpan)
throw new ArgumentOutOfRangeException(nameof(period), "Cannot use InfiniteTimeSpan period to create a reminder");

if (period.Ticks < 0)
throw new ArgumentOutOfRangeException(nameof(period), "Cannot use negative period to create a reminder");

var minReminderPeriod = options.MinimumReminderPeriod;
if (period < minReminderPeriod)
throw new ArgumentException($"Cannot register reminder {reminderName} as requested period ({period}) is less than minimum allowed reminder period ({minReminderPeriod})");
Expand Down Expand Up @@ -92,4 +97,4 @@ private static void ThrowInvalidContext()
+ " Ensure that you are only accessing grain functionality from within the context of a grain.");
}
}
}
}