❔ 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
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 betterI'll try out Coravel, thanks! I'd usually go for a scheduler but that doesn't really fit the application.
Coravel is very nice. Its implemented as a HostedService, so if you are using GenericHost its trivial to make work
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.