private async Task LoadRemindersAsync()

in src/Microsoft.ServiceFabric.Actors/Runtime/ActorManager.cs [1181:1234]


        private async Task LoadRemindersAsync(CancellationToken cancellationToken)
        {
            var reminders = await this.StateProvider.LoadRemindersAsync(cancellationToken);

            ActorTrace.Source.WriteInfoWithId(
                    TraceType,
                    this.traceId,
                    $"Loading {reminders.Count} reminders.");

            if (reminders.Count > 0 && !this.actorService.ActorTypeInformation.IsRemindable)
            {
                ActorTrace.Source.WriteWarningWithId(
                    TraceType,
                    this.traceId,
                    "LoadRemindersAsync: ActorStateProvider has {0} reminders but actor is not remindable.",
                    reminders.Count);

                return;
            }

            foreach (var actorReminders in reminders)
            {
                var actorId = actorReminders.Key;

                try
                {
                    var remindersToDelete = new List<string>();

                    foreach (var reminderState in actorReminders.Value)
                    {
                        if (this.ActorService.Settings.ReminderSettings.AutoDeleteOneTimeReminders &&
                            reminderState.RemainingDueTime < TimeSpan.Zero &&
                            this.IsOneTimeReminder(reminderState))
                        {
                            remindersToDelete.Add(reminderState.Name);
                            continue;
                        }

                        await this.RegisterOrUpdateReminderAsync(actorId, reminderState, false);
                    }

                    await this.DeleteRemindersSafeAsync(actorId, remindersToDelete, cancellationToken);
                }
                catch (Exception ex)
                {
                    ActorTrace.Source.WriteWarningWithId(
                        TraceType,
                        this.traceId,
                        "Exception encountered while configuring reminder for ActorId={0}. Exception={1}.",
                        actorId.ToString(),
                        ex.ToString());
                }
            }
        }