su-fit-vut / kachna-online

Students' Club U Kachničky: Member's portal
MIT License
5 stars 5 forks source link

States planned in distant future #121

Closed ondryaso closed 1 year ago

ondryaso commented 2 years ago

The state planner background service uses Task.Delay() to wait for the next planned state (see the call at line 113).

According to the .NET docs, this method throws an exception when the delay argument's TotalMilliseconds property is greater than 4294967294 on .NET 6 and later versions, or Int32.MaxValue on all previous versions.

I believe the app currently runs on .NET 5 in production. That means the maximum time that can pass between two states is 2147483647/1000/60/60/24 = 24.85 days. In other cases, the call throws and kills the app.

A check must be added for this constraint. If the target wait time is longer, it should be enough to just wait for the maximum possible time and then continue the while cycle so that the next state is repolled.

ondryaso commented 2 years ago

Thanks to @lukynmatuska for pointing this out... (the bad way though :rtzW:).

ondryaso commented 1 year ago

Fixed in #124.