Skip to content

Commit

Permalink
Async cron
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisa23 committed Nov 17, 2019
1 parent cb2a10a commit f1ff916
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 3 deletions.
Binary file added Fibrous.WPF/Fibrous.WPF.3.0.1-beta.nupkg
Binary file not shown.
4 changes: 2 additions & 2 deletions Fibrous.WPF/package.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
<metadata>
<id>Fibrous.WPF</id>
<version>3.0.0-beta</version>
<version>3.0.1-beta</version>
<authors>Chris Anderson</authors>
<owners>chrisa23</owners>
<projectUrl>http://github.com/chrisa23/fibrous</projectUrl>
Expand All @@ -12,7 +12,7 @@
<copyright>Copyright ©2018 CA Anderson LLC</copyright>
<tags>concurrency actors multi-threading messaging WPF</tags>
<dependencies>
<dependency id="Fibrous" version="3.0.0-beta" />
<dependency id="Fibrous" version="3.0.1-beta" />
</dependencies>
</metadata>
<files>
Expand Down
Binary file added Fibrous/Fibrous.3.0.1-beta.nupkg
Binary file not shown.
32 changes: 32 additions & 0 deletions Fibrous/IAsyncFiber.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,39 @@ public interface IAsyncExecutor
{
Task Execute(Func<Task> toExecute);
}
public static class AsyncSchedulerExtensions
{
/// <summary>
/// Schedule an action at a DateTime
/// </summary>
/// <param name="scheduler"></param>
/// <param name="action"></param>
/// <param name="when"></param>
/// <returns></returns>
public static IDisposable Schedule(this IAsyncScheduler scheduler, Func<Task> action, DateTime when)
{
return scheduler.Schedule(action, when - DateTime.Now);
}

/// <summary>
/// Schedule an action at a DateTime with an interval
/// </summary>
/// <param name="scheduler"></param>
/// <param name="action"></param>
/// <param name="when"></param>
/// <param name="interval"></param>
/// <returns></returns>
public static IDisposable Schedule(this IAsyncScheduler scheduler, Func<Task> action, DateTime when, TimeSpan interval)
{
return scheduler.Schedule(action, when - DateTime.Now, interval);
}


public static IDisposable CronSchedule(this IAsyncScheduler scheduler, Func<Task> action, string cron)
{
return new AsyncCronScheduler(scheduler, action, cron);
}
}
public static class AsyncFiberExtensions
{
/// <summary>
Expand Down
1 change: 1 addition & 0 deletions Fibrous/IFiber.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace Fibrous
{
Expand Down
1 change: 0 additions & 1 deletion Todo.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@
- better Req/reply tests
- add multi producer tests
- add queue full tests
- add cron scheduling
- clean up ctors to allow injection of schedulers

0 comments on commit f1ff916

Please sign in to comment.