Skip to content

Schedule plugin tickers after TickerQ initialises - #282

Merged
PianoNic merged 1 commit into
mainfrom
fix/281_TickerFunctionRegistration
Sep 10, 2026
Merged

PianoNic merged 1 commit into
mainfrom
fix/281_TickerFunctionRegistration

Conversation

@PianoNic

Copy link
Copy Markdown
Member

Summary

  • Plugin background tasks were never scheduled in 1.4.0. TickerQ only materialises its [TickerFunction] registry from its own initializer hosted service at host start, but plugins load - and register their tickers - in UseSchulyPluginsAsync() before that, so every write failed validation with Cannot find TickerFunction with name RunPluginTask and was swallowed as a warning.
  • TickerQPluginTaskScheduler now implements IHostedService: ticker writes that arrive before the host starts are queued in order and flushed from its StartAsync, which runs after TickerQ's initializer because it is registered after AddSchulyTickerQ.
  • Fixed a second failure the first one masked: TickerQ parses cron with NCrontab IncludingSeconds, so it needs 6 fields, while PluginSchedule validates and produces standard 5-field cron. Plugin expressions are now normalised to the 6-field form on the way into TickerQ and reported back in their 5-field form, and the status snapshot parses with seconds so next-run and interval stay correct.
  • Added an integration test that boots a host with the real TickerQ services instead of FakePluginTaskScheduler, loads a plugin before host start, and asserts the cron ticker is actually persisted and reported. The old tests passed through a fake scheduler, which is why this shipped.

Closes #281

Ticker writes issued while plugins load were validated against a function
registry TickerQ only builds when its own initializer hosted service starts,
so every plugin task was dropped with a logged warning. Queue those writes and
flush them from the scheduler's own StartAsync instead.

Also translate the 5-field plugin cron into the 6-field, seconds-first form
TickerQ parses, and back again for the status snapshot.
@PianoNic PianoNic added the bug Something isn't working label Sep 10, 2026
@PianoNic
PianoNic merged commit e71d3f8 into main Sep 10, 2026
1 check passed
@PianoNic
PianoNic deleted the fix/281_TickerFunctionRegistration branch September 10, 2026 10:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Plugin tasks are never scheduled: Cannot find TickerFunction with name RunPluginTask

1 participant