C
C#2y ago
Dultus

❔ Best way to wait for a certain time?

Imagine I have a program running on a server and I want to have it do a certain operation at 9am, what's the best way in C# to do so? I'd like to just have an event that triggers at this time. Is there a performance friendly way? I'd probably use a timer with an interval I calculate until it's 9am? Thanks!
4 Replies
Pobiega
Pobiega2y ago
use a scheduler. Is this purely in-app for a smaller thing, I suggest Coravel. If you have multiple worker nodes or its a larger project, perhaps Quartz or Hangfire suit you better
Dultus
DultusOP2y ago
I'll try out Coravel, thanks! I'd usually go for a scheduler but that doesn't really fit the application.
Pobiega
Pobiega2y ago
Coravel is very nice. Its implemented as a HostedService, so if you are using GenericHost its trivial to make work
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server