I have an SF actor service that works roughly like this:
- Upon startup in
RunAsyncthe service creates predefined set of actors and activates all of them by calling an emptyStartAsyncmethod (defined on theIActor-derived custom interface). - Each of the actors override
OnActivateAsyncin which it registers a reminder withdueTimeandperiodboth set to 10 seconds. - The actors do all the work within the
IRemindable.ReceiveReminderAsyncimplementation. 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
I have poked around the SF Actors framework source code (
ActorReminder.cs) and found out the answers (thanks to the beauty of open source :-):Actually, this never happens. The reason is that the
ActorReminderclass uses theSystem.Threading.Timerclass for triggering reminders by means of theChangemethod overload that uses theTimeout.InfiniteTimeSpanfor itsperiodargument. 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,ActorReminderwill „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 :-).