0

I have an SF actor service that works roughly like this:

  1. Upon startup in RunAsync the service creates predefined set of actors and activates all of them by calling an empty StartAsync method (defined on the IActor-derived custom interface).
  2. Each of the actors override OnActivateAsync in which it registers a reminder with dueTime and period both set to 10 seconds.
  3. The actors do all the work within the IRemindable.ReceiveReminderAsync implementation. The work is usually quick (~100 milliseconds), but sometimes it can last for several minutes (I know that this is bad design, please do not comment on that :-)).

My question is: What happens when a reminder is due, but the actor still executes the previous callback code?

According to the documentation, the callbacks are queued, but I also wonder if the queue is limited somehow and what happens when the limit is reached?

Thanks for your feedback!

Palo

Palo Mraz
  • 625
  • 5
  • 16

1 Answers1

1

I have poked around the SF Actors framework source code (ActorReminder.cs) and found out the answers (thanks to the beauty of open source :-):

What happens when a reminder is due, but the actor still executes the previous callback code?

Actually, this never happens. The reason is that the ActorReminder class uses the System.Threading.Timer class for triggering reminders by means of the Change method overload that uses the Timeout.InfiniteTimeSpan for its period argument. This means that your reminder callback can execute for hours and SF will happily wait for it to complete without complaining. After the reminder callback completes, ActorReminder will „rearm“ the timer for the due time you specified when registering the reminder.

This also means that there are no such things as queued reminder callbacks, which obviously answers my second question :-).

Palo Mraz
  • 625
  • 5
  • 16