{"id":28508866,"url":"https://github.com/michalmoudry/fs-cron","last_synced_at":"2026-05-09T14:16:39.620Z","repository":{"id":295467177,"uuid":"841023124","full_name":"MichalMoudry/fs-cron","owner":"MichalMoudry","description":"A .NET library for periodically running tasks","archived":false,"fork":false,"pushed_at":"2025-05-25T17:41:41.000Z","size":7,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-08T22:01:45.916Z","etag":null,"topics":["cronjob-scheduler","csharp","dotnet","dotnet-9","fsharp"],"latest_commit_sha":null,"homepage":"","language":"F#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MichalMoudry.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-08-11T12:15:20.000Z","updated_at":"2025-05-25T17:23:01.000Z","dependencies_parsed_at":"2025-05-25T18:54:44.053Z","dependency_job_id":null,"html_url":"https://github.com/MichalMoudry/fs-cron","commit_stats":null,"previous_names":["michalmoudry/fs-cron"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/MichalMoudry/fs-cron","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MichalMoudry%2Ffs-cron","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MichalMoudry%2Ffs-cron/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MichalMoudry%2Ffs-cron/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MichalMoudry%2Ffs-cron/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MichalMoudry","download_url":"https://codeload.github.com/MichalMoudry/fs-cron/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MichalMoudry%2Ffs-cron/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263226566,"owners_count":23433739,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cronjob-scheduler","csharp","dotnet","dotnet-9","fsharp"],"created_at":"2025-06-08T22:00:49.470Z","updated_at":"2026-05-09T14:16:39.531Z","avatar_url":"https://github.com/MichalMoudry.png","language":"F#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# FsCron\nA .NET library for periodically running tasks. This library was built on top of [Cronos](https://github.com/HangfireIO/Cronos).\n\n## Basic usage\n```csharp\nawait using var scheduler = new Scheduler(TimeZoneInfo.Local);\n\nscheduler.NewAsyncJob(\n    \"* * * * *\",\n    async token =\u003e\n    {\n        Console.WriteLine($\"[{DateTimeOffset.Now}] Test print\");\n        await Task.Delay(1000, token);\n    }\n);\n\nscheduler.Start();\n```\n\n### Async usage\nAsynchronous usage is about running the scheduler in a separate thread.\n\n```csharp\nawait using var scheduler = new Scheduler(TimeZoneInfo.Local);\n\nscheduler.NewAsyncJob(\n    \"* * * * *\",\n    async token =\u003e\n    {\n        Console.WriteLine($\"[{DateTimeOffset.Now}] Test print\");\n        await Task.Delay(1000, token);\n    }\n);\n\nscheduler.StartAsync();\n```\nInternally, `Scheduler` class has two methods `Start()` and `StartAsync()`. `Start()` executes startInternal() method directly and `StartAsync()` treats startInternal() as a ThreadStart delegate for a background [Thread](https://learn.microsoft.com/en-us/dotnet/api/system.threading.thread?view=net-9.0 \"Link to Thread class documentation\").\n\n## Types of jobs\n- Async job - A [Func](https://learn.microsoft.com/en-us/dotnet/api/system.func-2?view=net-9.0) delegate that has one parameter (cancellation token) and returns a Task. The returned task is not awaited, but rather started on a thread pool.\n- Sync job: An [Action](https://learn.microsoft.com/en-us/dotnet/api/system.action?view=net-9.0 \"Link to Action delegate documentation\") delegate that is periodically queued on the thread pool, so that it is not blocking scheduler's own execution.\n\n## Job cancellation\n`Scheduler` class realizes IDisposable (and IAsyncDisposable) interface. Also, the class internally stores a CancellationTokenSource which is cancelled and disposed along side the scheduler itself.\n\n## AOT compatibility\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichalmoudry%2Ffs-cron","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmichalmoudry%2Ffs-cron","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichalmoudry%2Ffs-cron/lists"}