tick method
Runs one full tick: reconcile -> validate -> fetch -> dispatch.
Public for tests; the poll loop calls this in the background.
Implementation
Future<void> tick() async {
if (_shuttingDown) return;
try {
await _reconcileRunningIssues();
final errors = config.validateForDispatch();
_validationErrors
..clear()
..addAll(errors);
if (errors.isNotEmpty) {
_record(
'dispatch_validation_failed',
'Dispatch skipped: ${errors.join(' ')}',
);
_scheduleNextTick();
return;
}
final candidatesResult = await tracker.fetchCandidates();
candidatesResult.fold((failure) {
_record(
'tracker_fetch_failed',
'Tracker fetch failed: ${failure.message}',
data: <String, dynamic>{'code': failure.code.name},
);
}, _dispatchCandidates);
} catch (e, stack) {
logger.err('Scheduler tick failed: $e\n$stack');
_record('tick_error', 'Scheduler tick failed: $e');
} finally {
_scheduleNextTick();
}
}