[Cuis-dev] [QUESTION] Delays after image startup
Gerald Klix
cuis.01 at klix.ch
Wed Jul 19 13:06:34 PDT 2023
Hi Juan,
thanks for your answer and apologies for my late reply;
I was on the road again.
Please see below.
On 7/17/23 4:27 PM, Juan Vuletich wrote:
> On 7/10/2023 7:13 AM, Gerald Klix via Cuis-dev wrote:
>> Hi all,
>>
>> I am a bit hesitant to report this as a defect.
>>
>> It looks like that the resumption of
>> processes stopped by instances of Delay
>> does not always work after image startup.
>>
>> At least for delays that expire during the time
>> the image was down, if the clock wraps around
>> midnight. Actually these processes seem to be woken
>> up at the same time of day, but one day later.
>>
>> Is this the expected behavior?
>>
>>
>> Best Regards,
>>
>> Gerald
>
> I think that all Delays that expired when the image was not running
> should simply be discarded at startup. Otherwise there is a real risk
> of the image not starting again, or getting stuck.
>
To me this makes sense. Additionally we could get rid of the
complicated logic in the category snapshotting of class Delay.
Do you want to terminated the associated processes, too?
> I also think that saving an image with suspended Delays is not a good
> idea...
>
In that case, we can get rid of the delays when saving the image.
Again the question about the associated processes arises.
The current semantics of delays in saved images is surprising
and probably unintentional; at least it needs some words
of explanations in Delay's class comment.
Any how, I implemented Alarms for items in a todo-list with delays.
The solution for the aforementioned problem is to "reschedule"
all the alarms when starting the image. "Reschedule" means
terminated the old process waiting on the delay and create
a new one, if the alarm still lies in the future.
Otherwise change the alarm's due time to 5 seconds
in the future, to alert the user shortly after image startup.
I implemented this behavior using initClassCachedState.
This way the alarms are rescheduled even when
I just save the image.
Best Regards,
Gerald
More information about the Cuis-dev
mailing list