TickerNet docs Sponsored by Omniscient AI

TickerNet · changing it

Contributing to TickerNet

How to get the code building, where everything lives, and how one job travels from a [TickerFunction] method to a row on the dashboard. Read CONTRIBUTING.md in the repository too: its two rules apply to every pull request.

On this page
  1. Set up
  2. Repository map
  3. Build and test
  4. How a job moves through the code
  5. The two rules
  6. Pull requests
  7. Adding an ADR
01

Set up

  • .NET 11 SDK and the .NET 10 runtime. The packages and tests target net10.0 and net11.0, samples and benchmarks target net11.0, and the source generator targets netstandard2.0, as Roslyn requires.
  • Node.js, current LTS. For the dashboard's web app in src/TickerNet.Dashboard/wwwroot (Vue 3, Vite, Vuetify, Vitest).
  • Docker. The MongoDB tests start a MongoDB container with Testcontainers. The other tests need no services: EF Core tests use SQLite, and the rest use in-memory stores and NSubstitute.
  • Git with your real name and email. Every commit needs a sign-off that matches its author (rule 1).
shellget the code
git clone https://github.com/TickerNet/TickerNet.git
cd TickerNet
02

Repository map

One solution, TickerNet.slnx. Shared build settings for every package are in src/Directory.Build.props.

samples/TickerNet.Sample.Dashboard.ReflectionFree is in the repository but not in TickerNet.slnx, so the solution build skips it.

03

Build and test

The same commands as CONTRIBUTING.md and .github/workflows/ci.yaml.

shellfull build and test
# Dashboard web app (embedded into TickerNet.Dashboard)
(cd src/TickerNet.Dashboard/wwwroot && npm ci && npm run build && npm test)

# The core package bundles the source generator, so build it first
dotnet build src/TickerNet.SourceGenerator/TickerNet.SourceGenerator.csproj -c Release
dotnet build TickerNet.slnx -c Release
dotnet test TickerNet.slnx -c Release --no-build
  • Why the generator goes first. src/TickerNet/TickerNet.csproj packs TickerNet.SourceGenerator.dll from the generator's bin/$(Configuration)/netstandard2.0/ folder into analyzers/dotnet/cs. Building the solution also writes packages, because GeneratePackageOnBuild is on.
  • One test project. dotnet test tests/TickerNet.Tests -c Release. Add --filter to run fewer tests.
  • A sample. dotnet run --project samples/TickerNet.Sample.WebApi, then post to /schedule-sample and open /tickernet/dashboard.
  • Benchmarks. dotnet run -c Release --project benchmarks/TickerNet.Benchmarks. It uses BenchmarkDotNet's switcher, so you pick benchmarks from a menu or pass --filter.
04

How a job moves through the code

Follow one job from compile time to the dashboard. Paths are from the repository root.

overviewone job, start to finish
compile   [TickerFunction] method
            └─ TickerNetIncrementalSourceGenerator ─► TickerNetInstanceFactory.g.cs
                 [ModuleInitializer] Initialize() ─► TickerFunctionProvider.RegisterFunctions

startup   AddTickerNet ─► services          UseTickerNet ─► InitializationRequested = true
            └─ TickerNetInitializerHostedService: Build() registry, seed crons, run seeders

schedule  ITimeTickerManager.AddAsync ─► TickerManager ─► ITickerPersistenceProvider.AddTimeTickers
            ├─ due within 1 s ─► TickerNetDispatcher.DispatchAsync ─────────────────┐
            └─ later ─► ITickerNetHostScheduler.RestartIfNeeded                     │
                                                                                    │
run       TickerNetSchedulerBackgroundService                                       │
            ├─ InternalTickerManager.GetNextTickers ─► store: earliest jobs, locked │
            ├─ wait until due ─► SetTickersInProgress                               │
            └─ TickerNetTaskScheduler.QueueAsync ◄──────────────────────────────────┘
                 └─ TickerExecutionTaskHandler.ExecuteTaskAsync ─► generated delegate ─► your method

record    InternalTickerManager.UpdateTickerAsync ─► store + ITickerNetNotificationHubSender
show      TickerNetNotificationHubSender ─► TickerNetNotificationHub (SignalR) ─► Vue app

1 · The source generator registers the function

  • src/TickerNet.SourceGenerator/TickerNetIncrementalSourceGenerator.cs is an incremental generator. It collects methods in the assembly being compiled that carry TickerFunctionAttribute, and skips the TickerNet assembly itself.
  • Validation/ (TickerFunctionValidator, CronValidator, ConstructorValidator, AttributeValidator) reports the diagnostics declared in Validation/DiagnosticDescriptors.cs. Analysis/ConstructorAnalyzer.cs picks the constructor, honouring [TickerNetConstructor] and [FromKeyedServices].
  • Generation/FactoryGenerator.cs fills the templates in Generation/Templates.cs to write TickerNetInstanceFactory.g.cs. Its Initialize() method is a [ModuleInitializer], so it runs when the assembly loads. It builds a dictionary from function name to cron expression, priority, TickerFunctionDelegate and max concurrency, and passes it to TickerFunctionProvider.RegisterFunctions. Request types for TickerFunctionContext<T> go to RegisterRequestType. Generation/FunctionRefsGenerator.cs writes the typed TickerFunctions references.
  • Functions registered in code take the same route: MapTicker in src/TickerNet/DependencyInjection/TickerNetEndpointExtensions.cs calls RegisterFunctions directly.
  • Tests: tests/TickerNet.SourceGenerator.Tests.

2 · Registration and startup

  • AddTickerNet in src/TickerNet/DependencyInjection/TickerNetServiceExtensions.cs builds the TickerOptionsBuilder and SchedulerOptionsBuilder from src/TickerNet.Utilities/TickerOptionsBuilder.cs. It registers TickerManager<,> as both managers, InternalTickerManager<,>, no-op Redis and dashboard senders, the hosted services, the worker pool, the dispatcher and TickerExecutionTaskHandler.
  • Stores and extensions plug in through extension methods on the options builder that add to its ExternalProviderConfigServiceAction. After those run, TryAddSingleton adds TickerInMemoryPersistenceProvider only if no store registered one. The extension packages see these internal members through InternalsVisibleTo in src/TickerNet.Utilities/Properties/AssemblyInfo.cs; a new first-party package has to be added there.
  • UseTickerNet sets InitializationRequested on TickerNetInitializerHostedService, connects scheduler events to the dashboard sender, and adds the dashboard middleware.
  • When the host starts, src/TickerNet/Src/BackgroundServices/TickerNetInitializerHostedService.cs resolves %key% cron placeholders from configuration, calls TickerFunctionProvider.Build() to freeze the registrations into frozen dictionaries, seeds cron jobs through IInternalTickerManager.MigrateDefinedCronTickers, runs the seeders, skips stale cron runs if asked, and runs the store's startup action. TickerNetStartupValidator, registered last, warns when UseTickerNet was not called or no functions exist.

3 · Scheduling and the scheduler loop

  • A manager call lands in src/TickerNet.Utilities/Managers/TickerManager.cs. It checks the function exists, converts the time to UTC and saves the job. If the job is due within one second it claims it with AcquireImmediateTimeTickersAsync and hands it to TickerNetDispatcher.DispatchAsync (src/TickerNet/Src/Dispatcher/TickerNetDispatcher.cs). Otherwise it calls RestartIfNeeded so the loop wakes early if this job is sooner than the one it was waiting for.
  • src/TickerNet/Src/BackgroundServices/TickerNetSchedulerBackgroundService.cs runs the loop in RunTickerNetSchedulerAsync. InternalTickerManager.GetNextTickers (src/TickerNet.Utilities/Managers/InternalTickerManager.cs) asks the store for the earliest time jobs and cron runs and locks them for this node. The loop sleeps until they are due, at least MinPollingInterval and at most a day. Then it marks them in progress with SetTickersInProgress and queues each one, in priority order, behind its function's semaphore from TickerFunctionConcurrencyGate.
  • TickerNetFallbackBackgroundService runs every FallbackIntervalChecker and calls RunTimedOutTickers, which picks up jobs more than a second past due that are still waiting.

4 · The worker pool runs it

  • src/TickerNet/Src/TickerNetThreadPool/TickerNetTaskScheduler.cs runs up to MaxConcurrency worker threads named TickerNet.Worker-{n}, each with its own queue, and lets idle workers steal work. Idle workers stop after IdleWorkerTimeOut. LongRunning work skips the pool and runs on a task created with TaskCreationOptions.LongRunning; the pool itself does not reorder by priority.
  • src/TickerNet/Src/TickerExecutionTaskHandler.cs builds the TickerFunctionContext, registers the run's cancellation with TickerCancellationTokenManager, then for each attempt creates a new async DI scope and calls the cached TickerFunctionDelegate. It waits between retries (RetryIntervals, or 30 seconds), sets the final TickerStatus, calls ITickerExceptionHandler if one is set, and then runs or skips child jobs by their RunCondition. Each change is saved through InternalTickerManager.UpdateTickerAsync, and logged and traced through ITickerNetInstrumentation.

5 · The store keeps it

  • The contract is ITickerPersistenceProvider<TTimeTicker, TCronTicker> in src/TickerNet.Utilities/Interfaces/ITickerPersistenceProvider.cs: find and lock due jobs, release locks, save status, release a dead node's jobs, the create, read, update and delete calls the managers and dashboard use, and ITickerQueryable queries.
  • Implementations: src/TickerNet/Src/Provider/TickerInMemoryPersistenceProvider.cs; src/TickerNet.EntityFrameworkCore/Infrastructure/BasePersistenceProvider.cs and TickerEFCorePersistenceProvider.cs; src/TickerNet.Caching.StackExchangeRedis/Infrastructure/BaseRedisPersistenceProvider.cs and TickerRedisPersistenceProvider.cs with the Lua scripts in Scripts/ (Acquire.lua, Release.lua, RecoverDeadNode.lua); src/TickerNet.MongoDB/Infrastructure/TickerMongoPersistenceProvider.cs.
  • A lock is the job's LockHolder set to the node's NodeIdentifier while its status moves from Idle or Queued to InProgress. With Redis, NodeHeartBeatBackgroundService writes heartbeats through TickerNetRedisContext and releases the jobs of nodes whose heartbeat is gone via InternalTickerManager.ReleaseDeadNodeResources.

6 · The dashboard shows it

  • Without the dashboard, events go to src/TickerNet.Utilities/Temps/NoOpTickerNetNotificationHubSender.cs. AddDashboard (src/TickerNet.Dashboard/DependencyInjection/ServiceExtensions.cs) swaps in Hubs/TickerNetNotificationHubSender.cs, which sends events such as UpdateTimeTickerNotification and UpdateCronTickerNotification to clients of Hubs/TickerNetNotificationHub.cs.
  • DependencyInjection/ServiceCollectionExtensions.cs builds the dashboard branch: embedded static files from wwwroot/dist, __tickernet-config.js, CORS, sign-in (Authentication/AuthMiddleware.cs, AuthService.cs), the endpoints in Endpoints/DashboardEndpoints.cs under api/, the hub at ticker-notification-hub, and a fallback that serves the web app.
  • Reads go through Infrastructure/Dashboard/TickerDashboardRepository.cs and src/TickerNet.Utilities/Infrastructure/TickerDashboardDataService.cs. In the web app, wwwroot/src/services/signalr.ts and hub/ listen to the hub, and services/http.ts calls the API.

7 · Remote functions take one more hop

When TickerNet.Hub is in the scheduler, a function named function@node runs in a worker process instead. Steps 2 to 5 are the same on the scheduler; only the delegate differs. Remote workers describes the behaviour and ADR 0009 the design.

  • The protocol. src/TickerNet.Hub/Protos/worker.proto defines one bidirectional stream, WorkerHub.OpenWorkerStream. src/TickerNet.Hub/Protocol/HelloSignature.cs signs and checks the worker's Hello. TickerNet.Worker compiles both files through links in its project file, so the two sides can't drift apart. The generated types are internal in each assembly.
  • The worker connects. AddTickerNetWorker in src/TickerNet.Worker/TickerNetWorkerServiceExtensions.cs turns off the background services and cron seeding and registers Internal/WorkerClient.cs and Internal/RemotePersistenceProvider.cs. Once the host has started, WorkerClient opens the stream and sends a Hello with the functions listed by Internal/FunctionManifest.cs, then sends heartbeats and reconnects with backoff.
  • The scheduler registers it. src/TickerNet.Hub/Internal/WorkerStreamService.cs checks the call's signed headers with HelloSignature and HelloReplayGuard before reading the stream, then checks the Hello and sends a signed HelloAck. It adds the worker to WorkerRegistry and its functions to RemoteFunctionCatalog, which publishes the union of each node's functions as function@node with TickerFunctionProvider.MergeRemoteFunctions. RemoteCronSeeder seeds their cron jobs. WorkerMonitors.cs drops silent workers and pauses cron jobs no connected worker can run. Requests from the worker to add, change or remove jobs are checked against its own node in the same file.
  • A run is sent. The scheduler loop and TickerExecutionTaskHandler run as in steps 3 and 4. The cached delegate for function@node comes from Internal/RemoteDispatch.cs: it waits for a worker that declared the function with WorkerRegistry.WaitForWorkerAsync, loads the stored request with RemotePayloadLoader, sends ExecuteFunction through WorkerConnection.ExecuteAsync and maps the ExecutionResult back to success or an exception. A run the worker rejected, or that couldn't be sent, goes to another worker. Internal/HubTaskHandler.cs wraps ITickerExecutionTaskHandler to supply that delegate to runs that have none yet.
  • The worker runs it. WorkerClient looks the function up in its own TickerFunctionProvider, runs one attempt in a new DI scope within the concurrency limits, and replies. Jobs the worker's code adds go through RemotePersistenceProvider to the scheduler's managers.
  • Tests: tests/TickerNet.Hub.Tests. It references the worker project with the alias worker, because both assemblies contain the protocol types, and runs tests one at a time because TickerFunctionProvider is process-wide.
05

The two rules

A summary. CONTRIBUTING.md is the full text.

Rule 1: sign off every commit (DCO)

TickerNet has no contributor license agreement. You keep the copyright in your work and license it to everyone under MIT OR Apache-2.0. To confirm you have the right to do that, sign off each commit under the Developer Certificate of Origin 1.1. The Signed-off-by name and email must match the commit author. .github/workflows/dco.yaml checks every commit in a pull request.

shellsign off, or fix a missing sign-off
git commit -s -m "Fix cron parsing for leap years"

git commit --amend -s --no-edit     # last commit
git rebase --signoff main           # every commit on your branch, then force-push

Rule 2: clean room for TickerQ's commercial versions

  • Never copy, adapt or translate code, tests, documentation, examples, UI or other material from TickerQ 10.5.0 or later, from TickerQ's main branch at or after commit 13a9b544 (19 October 2026), or from the matching 8.5.0, 9.5.0 and 11.5.0 builds and anything later.
  • Don't read that code to build a feature here. Work from a description of what the feature does: an issue, a public changelog entry, or your own design. Don't decompile TickerQ's commercial packages.
  • Write your own words. Don't copy text from TickerQ's documentation site.
  • Say so if you can't stay clean. If you have worked with TickerQ's commercial source, mention it in your pull request and leave features you saw there to someone else.
  • Coding agents follow the same rule. Don't point an AI assistant at TickerQ's commercial source. AGENTS.md gives agents this rule.

TickerQ code from before commit 13a9b544 is MIT OR Apache-2.0, and its history up to the fork point is in this repository. ADR 0004 explains the rule.

06

Pull requests

  1. Open an issue first for anything bigger than a small fix, so the approach is agreed before you write it.
  2. One change per pull request, branched from main, with tests for new behaviour. Follow the existing code style.
  3. List public API changes in the description. Everything public in src/ is API; keep changes small, and don't rename or remove public members without an ADR.
  4. Update the docs in the same pull request: README.md, the package READMEs and site/.
  5. Pass the checks. .github/workflows/ci.yaml builds and tests the web app and the solution, and dco.yaml checks sign-offs. The pull request template's checklist repeats the rules above.
  6. Merging. A maintainer approves and merges with squash and merge, as Governance describes.
  7. Ask for another look. After you push the changes a reviewer asked for, comment /review on the pull request. That asks everyone who reviewed it, and hasn't approved yet, to look again (.github/workflows/review-request.yaml). You can also @-mention the reviewer instead.
  8. Credit. After your first pull request is merged, your name goes in CONTRIBUTORS.md. Add it in your pull request, or the maintainer who merges it will.

Report bugs in GitHub Issues with the TickerNet and .NET versions and steps to reproduce. Ask questions and float ideas in Discussions. To find a first task, look for issues labelled good first issue. Report security problems privately, as Governance explains.

07

Adding an ADR

An architecture decision record explains one decision. The log is in site/decisions/.

  1. Decide whether it needs one. Write an ADR when a change picks between real alternatives, adds or removes a package or public interface, or sets a rule other changes must follow. Changes to GOVERNANCE.md always need one.
  2. Copy the template. Copy site/decisions/template.html to the next free NNNN-short-slug.html. Numbers are never reused.
  3. Fill it in. Context, Decision, Alternatives considered, Consequences, Where it lives and Sources. Every fact needs a source: a pull request, commit or file. If a reason was never written down, write "Not recorded" instead of guessing.
  4. Link it. Add a row to the right table in site/decisions/index.html, update the counts in its header, and update the pagers of the records before and after it.
  5. Don't rewrite history. To change an accepted decision, add a dated amendment to its status line, or write a new ADR that supersedes it and link both ways.