refactor(indexer): extract ScheduledTask abstraction from Dispatcher

What does this MR do and why?

The Dispatcher trait coupled two concerns: scheduling (cadence locks, intervals) and semantics (publishing work to NATS). Adding a scheduled task that doesn't fan out work — like a daily OPTIMIZE TABLE FINAL CLEANUP — meant either abusing the dispatcher abstraction or duplicating the scheduling infrastructure.

This MR extracts a ScheduledTask trait that only cares about when to run, not what the task does. The existing dispatchers implement it unchanged; they just happen to publish to NATS in their run() method. Future maintenance tasks can implement the same trait without pretending to be dispatchers.

Changes

Trait and type renames:

Before After
Dispatcher ScheduledTask
dispatch() run()
dispatcher_config() schedule()
DispatchError TaskError
DispatcherConfiguration ScheduleConfiguration
DispatchConfig ScheduleConfig
DispatchMetrics ScheduledTaskMetrics

Metrics:

  • Moved ScheduledTaskMetrics from modules/sdlc/dispatch/ to dispatcher/ — it's shared infrastructure, not SDLC-specific
  • Meter: indexer_dispatchscheduler
  • Metric names: indexer.dispatch.*scheduler.task.*
  • Label: dispatchertask

Task names now include a category prefix (dispatch.sdlc.global, dispatch.code.project) so non-dispatch tasks added later are naturally distinguished.

Config keys: dispatch.dispatchersschedule.tasks (helm values and templates updated).

Testing

Unit and integration tests are ok

Performance Analysis

  • This merge request does not introduce any performance regression. If a performance regression is expected, explain why.

Merge request reports

Loading