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.
Set up
- .NET 11 SDK and the .NET 10 runtime. The packages and tests target
net10.0andnet11.0, samples and benchmarks targetnet11.0, and the source generator targetsnetstandard2.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).
git clone https://github.com/TickerNet/TickerNet.git
cd TickerNetRepository 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.
Build and test
The same commands as CONTRIBUTING.md and .github/workflows/ci.yaml.
# 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.csprojpacksTickerNet.SourceGenerator.dllfrom the generator'sbin/$(Configuration)/netstandard2.0/folder intoanalyzers/dotnet/cs. Building the solution also writes packages, becauseGeneratePackageOnBuildis on. - One test project.
dotnet test tests/TickerNet.Tests -c Release. Add--filterto run fewer tests. - A sample.
dotnet run --project samples/TickerNet.Sample.WebApi, then post to/schedule-sampleand 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.
How a job moves through the code
Follow one job from compile time to the dashboard. Paths are from the repository root.
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 app1 · The source generator registers the function
src/TickerNet.SourceGenerator/TickerNetIncrementalSourceGenerator.csis an incremental generator. It collects methods in the assembly being compiled that carryTickerFunctionAttribute, and skips theTickerNetassembly itself.Validation/(TickerFunctionValidator,CronValidator,ConstructorValidator,AttributeValidator) reports the diagnostics declared inValidation/DiagnosticDescriptors.cs.Analysis/ConstructorAnalyzer.cspicks the constructor, honouring[TickerNetConstructor]and[FromKeyedServices].Generation/FactoryGenerator.csfills the templates inGeneration/Templates.csto writeTickerNetInstanceFactory.g.cs. ItsInitialize()method is a[ModuleInitializer], so it runs when the assembly loads. It builds a dictionary from function name to cron expression, priority,TickerFunctionDelegateand max concurrency, and passes it toTickerFunctionProvider.RegisterFunctions. Request types forTickerFunctionContext<T>go toRegisterRequestType.Generation/FunctionRefsGenerator.cswrites the typedTickerFunctionsreferences.- Functions registered in code take the same route:
MapTickerinsrc/TickerNet/DependencyInjection/TickerNetEndpointExtensions.cscallsRegisterFunctionsdirectly. - Tests:
tests/TickerNet.SourceGenerator.Tests.
2 · Registration and startup
AddTickerNetinsrc/TickerNet/DependencyInjection/TickerNetServiceExtensions.csbuilds theTickerOptionsBuilderandSchedulerOptionsBuilderfromsrc/TickerNet.Utilities/TickerOptionsBuilder.cs. It registersTickerManager<,>as both managers,InternalTickerManager<,>, no-op Redis and dashboard senders, the hosted services, the worker pool, the dispatcher andTickerExecutionTaskHandler.- Stores and extensions plug in through extension methods on the options builder that add to its
ExternalProviderConfigServiceAction. After those run,TryAddSingletonaddsTickerInMemoryPersistenceProvideronly if no store registered one. The extension packages see these internal members throughInternalsVisibleToinsrc/TickerNet.Utilities/Properties/AssemblyInfo.cs; a new first-party package has to be added there. UseTickerNetsetsInitializationRequestedonTickerNetInitializerHostedService, connects scheduler events to the dashboard sender, and adds the dashboard middleware.- When the host starts,
src/TickerNet/Src/BackgroundServices/TickerNetInitializerHostedService.csresolves%key%cron placeholders from configuration, callsTickerFunctionProvider.Build()to freeze the registrations into frozen dictionaries, seeds cron jobs throughIInternalTickerManager.MigrateDefinedCronTickers, runs the seeders, skips stale cron runs if asked, and runs the store's startup action.TickerNetStartupValidator, registered last, warns whenUseTickerNetwas 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 withAcquireImmediateTimeTickersAsyncand hands it toTickerNetDispatcher.DispatchAsync(src/TickerNet/Src/Dispatcher/TickerNetDispatcher.cs). Otherwise it callsRestartIfNeededso the loop wakes early if this job is sooner than the one it was waiting for. src/TickerNet/Src/BackgroundServices/TickerNetSchedulerBackgroundService.csruns the loop inRunTickerNetSchedulerAsync.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 leastMinPollingIntervaland at most a day. Then it marks them in progress withSetTickersInProgressand queues each one, in priority order, behind its function's semaphore fromTickerFunctionConcurrencyGate.TickerNetFallbackBackgroundServiceruns everyFallbackIntervalCheckerand callsRunTimedOutTickers, 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.csruns up toMaxConcurrencyworker threads namedTickerNet.Worker-{n}, each with its own queue, and lets idle workers steal work. Idle workers stop afterIdleWorkerTimeOut.LongRunningwork skips the pool and runs on a task created withTaskCreationOptions.LongRunning; the pool itself does not reorder by priority.src/TickerNet/Src/TickerExecutionTaskHandler.csbuilds theTickerFunctionContext, registers the run's cancellation withTickerCancellationTokenManager, then for each attempt creates a new async DI scope and calls the cachedTickerFunctionDelegate. It waits between retries (RetryIntervals, or 30 seconds), sets the finalTickerStatus, callsITickerExceptionHandlerif one is set, and then runs or skips child jobs by theirRunCondition. Each change is saved throughInternalTickerManager.UpdateTickerAsync, and logged and traced throughITickerNetInstrumentation.
5 · The store keeps it
- The contract is
ITickerPersistenceProvider<TTimeTicker, TCronTicker>insrc/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, andITickerQueryablequeries. - Implementations:
src/TickerNet/Src/Provider/TickerInMemoryPersistenceProvider.cs;src/TickerNet.EntityFrameworkCore/Infrastructure/BasePersistenceProvider.csandTickerEFCorePersistenceProvider.cs;src/TickerNet.Caching.StackExchangeRedis/Infrastructure/BaseRedisPersistenceProvider.csandTickerRedisPersistenceProvider.cswith the Lua scripts inScripts/(Acquire.lua,Release.lua,RecoverDeadNode.lua);src/TickerNet.MongoDB/Infrastructure/TickerMongoPersistenceProvider.cs. - A lock is the job's
LockHolderset to the node'sNodeIdentifierwhile its status moves fromIdleorQueuedtoInProgress. With Redis,NodeHeartBeatBackgroundServicewrites heartbeats throughTickerNetRedisContextand releases the jobs of nodes whose heartbeat is gone viaInternalTickerManager.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 inHubs/TickerNetNotificationHubSender.cs, which sends events such asUpdateTimeTickerNotificationandUpdateCronTickerNotificationto clients ofHubs/TickerNetNotificationHub.cs. DependencyInjection/ServiceCollectionExtensions.csbuilds the dashboard branch: embedded static files fromwwwroot/dist,__tickernet-config.js, CORS, sign-in (Authentication/AuthMiddleware.cs,AuthService.cs), the endpoints inEndpoints/DashboardEndpoints.csunderapi/, the hub atticker-notification-hub, and a fallback that serves the web app.- Reads go through
Infrastructure/Dashboard/TickerDashboardRepository.csandsrc/TickerNet.Utilities/Infrastructure/TickerDashboardDataService.cs. In the web app,wwwroot/src/services/signalr.tsandhub/listen to the hub, andservices/http.tscalls 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.protodefines one bidirectional stream,WorkerHub.OpenWorkerStream.src/TickerNet.Hub/Protocol/HelloSignature.cssigns and checks the worker's Hello.TickerNet.Workercompiles 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.
AddTickerNetWorkerinsrc/TickerNet.Worker/TickerNetWorkerServiceExtensions.csturns off the background services and cron seeding and registersInternal/WorkerClient.csandInternal/RemotePersistenceProvider.cs. Once the host has started,WorkerClientopens the stream and sends a Hello with the functions listed byInternal/FunctionManifest.cs, then sends heartbeats and reconnects with backoff. - The scheduler registers it.
src/TickerNet.Hub/Internal/WorkerStreamService.cschecks the call's signed headers withHelloSignatureandHelloReplayGuardbefore reading the stream, then checks the Hello and sends a signed HelloAck. It adds the worker toWorkerRegistryand its functions toRemoteFunctionCatalog, which publishes the union of each node's functions asfunction@nodewithTickerFunctionProvider.MergeRemoteFunctions.RemoteCronSeederseeds their cron jobs.WorkerMonitors.csdrops 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
TickerExecutionTaskHandlerrun as in steps 3 and 4. The cached delegate forfunction@nodecomes fromInternal/RemoteDispatch.cs: it waits for a worker that declared the function withWorkerRegistry.WaitForWorkerAsync, loads the stored request withRemotePayloadLoader, sendsExecuteFunctionthroughWorkerConnection.ExecuteAsyncand maps theExecutionResultback to success or an exception. A run the worker rejected, or that couldn't be sent, goes to another worker.Internal/HubTaskHandler.cswrapsITickerExecutionTaskHandlerto supply that delegate to runs that have none yet. - The worker runs it.
WorkerClientlooks the function up in its ownTickerFunctionProvider, runs one attempt in a new DI scope within the concurrency limits, and replies. Jobs the worker's code adds go throughRemotePersistenceProviderto the scheduler's managers. - Tests:
tests/TickerNet.Hub.Tests. It references the worker project with the aliasworker, because both assemblies contain the protocol types, and runs tests one at a time becauseTickerFunctionProvideris process-wide.
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.
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-pushRule 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.mdgives 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.
Pull requests
- Open an issue first for anything bigger than a small fix, so the approach is agreed before you write it.
- One change per pull request, branched from
main, with tests for new behaviour. Follow the existing code style. - 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. - Update the docs in the same pull request:
README.md, the package READMEs andsite/. - Pass the checks.
.github/workflows/ci.yamlbuilds and tests the web app and the solution, anddco.yamlchecks sign-offs. The pull request template's checklist repeats the rules above. - Merging. A maintainer approves and merges with squash and merge, as Governance describes.
- Ask for another look. After you push the changes a reviewer asked for, comment
/reviewon 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. - 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.
Adding an ADR
An architecture decision record explains one decision. The log is in site/decisions/.
- 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.mdalways need one. - Copy the template. Copy
site/decisions/template.htmlto the next freeNNNN-short-slug.html. Numbers are never reused. - 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.
- 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. - 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.