You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
void Run(...) changed to Task RunAsync(...) (from #1)
Now it's easier to write async code (but inside it's still one Task from thread pool that wait your code for complete and sleep between runs, no magic here).
IServiceProvider added as RunAsync parameter
You should use it for obtaining scoped-lifetime objects in case you force you IRunnable be singleton (in AddTask, see below).
Startup.cs changes
You may change lifetime of your IRunnable when calling AddTask<>. It's Transient by default, but you may change it: services.AddTask<MyFirstTask>(ServiceLifetime.Singleton) Important! No matter what lifetime your IRunnable has - every RunAsync is called inside new/own scope (disposed after run). Use IServiceProvider passed as parameter for correct service resolution!
You may pass CancellationToken to StartTask, and task will be stopped when this token got cancelled (issue #3)
ITask changes
Events BeforeRun, AfterRunSuccess and AfterRunFail replaced with async Func's - that's easier than async EventHandlers and EventArgs.