Skip to content

Releases: justdmitry/RecurrentTasks

v7.0: net8.0 only, fully async

23 Apr 18:29
v7.0.0
Compare
Choose a tag to compare
  • New: TaskRunner does not create dedicated Task, instead it uses async/await (and ThreadPool), becoming more efficient;
  • BREAKING: All previous framework support is dropped, only net8.0 is supported now;
  • BREAKING: Start() now throws InvalidOperationException (instead of ArgumentOutOfRangeException) when Options.FirstRunDelay is negative;
  • Fix: RunStatus.LastRunTime now updated even after failed run;

v6.6: net8.0

28 Nov 07:02
Compare
Choose a tag to compare
  • New TargetFramework added: net8.0. No any code changes, only framework reference.
  • Unsupported framework net5.0 removed from target networks. Ping me if you still need it.

v6.5

21 Jan 08:06
Compare
Choose a tag to compare
  • #14 Use your own ILogger implementation (add using options.WithLogger in AddTask)
  • WithCulture extension to easily set TaskOptions.RunCulture in AddTask

v6.4.1: Bugfix

11 Aug 11:32
v6.4.1
Compare
Choose a tag to compare

Fixes bug reported in #12. Now setting values for Interval and FirstRunDelay greater than 24d 20H (int.MaxValue in milliseconds) will throw ArgumentOutOfRange exception.

v6.4: .NET 5.0

12 Nov 11:11
v6.4
Compare
Choose a tag to compare

Library and test/samples now build for 3 frameworks: netstandard2.0, netcoreapp3.1 and net5.0

v6.3: NetCore 3.1

16 Dec 10:18
v6.3.0
Compare
Choose a tag to compare
  • Framework moniker netcoreapp3.0 updated to netcoreapp3.1, now library supports netstandard2.0 and netcoreapp3.1
  • Dependencies reorganized: Microsoft.AspNetCore.Http.Abstractions replaced with Microsoft.Extensions.DependencyInjection.Abstractions

v6.2: Multi-framework, less dependencies

26 Nov 14:56
v6.2.0
Compare
Choose a tag to compare
  1. Microsoft.Extensions.Options dependency removed
  2. Library now built for both netstandard2.0 and netcoreapp3.0 framework monikers, with updated dependencies for last one.

v6.1: TRunnable can be an interface

12 Aug 17:45
v6.1.0
Compare
Choose a tag to compare

Now you can call AddTask on interface (inherited from IRunnable) and register it's implementation later manually. This may be useful when you have several versions of same task and need to choose correct one on startup depending on configuration.

services.AddTask<IFileProcessorTask>(o => o.AutoStart(TimeSpan.FromMinutes(1)));

switch (configuration["FileProcessingMode"])
{
  case "Network":
    services.AddTransient<IFileProcessorTask, NetworkFileProcessorTask>();
    break;
  default:
    services.AddTransient<IFileProcessorTask, LocalFileProcessorTask>();
    break;
}

v6.0: Big changes

18 Oct 09:34
v6.0.0
Compare
Choose a tag to compare

1. IApplicationLifetime

Main reason of this version is IApplicationLifetime support (Issue #5) for better ASP.NET Core 2.1+ interaction. Now there is no more need for app.StartTask calls in your Startup.Configure - you need only services.AddTask<>(...) in Startup.ConfigureServices, and your task will be started/stopped automatically.

Doe to above, all configuration is moved to AddTask, so simplest task registration look like:

services.AddTask<SampleTask>(o => o.AutoStart(15)); // 15 min, TimeSpan also allowed

All additional configuration (Culture, FirstRunDelay, before/after handlers etc) should be done here. Please note slight property name changes.

2. ITask.Options

All configurable task options now available from ITask.Options property (e.g. for changing Interval from inside the task use currentTask.Options.Interval instead of currentTask.Interval) - that's breaking change you should pay attention to and update your tasks accordingly. Sorry.

3. ASP.NET Core 2.1 and netstandard2.0

As soon as IApplicationLifetime is supported only in ASP.NET Core 2.1 and above - depended libraries are upgraded to 2.1.0, and only netstandard2.0 target framework is supported (for netstartard1.0 and net46x use previous version).

4. Minor improvements

  • [Issue #6] ITask now have RunnableType read-only property, which returns typeof(TRunnable). This may be used for logging purposes etc.

v5: RunAsync and more

14 Feb 11:19
v5.0.0
Compare
Choose a tag to compare
  1. IRunnable changes
    1. 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).
    2. 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).
  2. Startup.cs changes
    1. 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!
    2. You may pass CancellationToken to StartTask, and task will be stopped when this token got cancelled (issue #3)
  3. ITask changes
    1. Events BeforeRun, AfterRunSuccess and AfterRunFail replaced with async Func's - that's easier than async EventHandlers and EventArgs.