mirror of
https://github.com/hanzoai/base.git
synced 2026-10-21 03:41:50 +00:00
tools/cron is now a thin alias over tools/tasks. The legacy ticker + crontab-matching implementation is deleted; the public surface (New, Add/MustAdd, Remove, RemoveAll, Jobs, HasJob, Total, Start, Stop, SetInterval, SetTimezone, HasStarted) is preserved so no callsite changes. app.Cron() and app.Tasks() share a single *tasks.Client, giving one obvious way to schedule work. - tools/tasks/client.go gains the primitives the cron shim needs (Remove, RemoveAll, HasJob, Total, Schedules, Run, PauseAll, ResumeAll, ActiveTickerCount) plus a richer internal scheduleEntry so remote vs local ticking are distinguishable. - cron.Cron.Stop() now pauses local tickers while preserving the registry, matching the legacy semantics expected by ResetBootstrapState and the admin API. - core/base.go builds app.cron via cron.NewFromTasks(app.tasks) so both accessors feed the same state. - apis/cron.go keeps the /crons list + run-now behaviour; lookup now uses HasJob() for an O(1) precheck. Tests rewritten around the shim (TestCronDelegatesToTasks, TestCronAppFacadeLocal, TestCronAppFacadeRemoteFallback, TestCronNewFromTasksShared). Legacy 1-minute-tick assertions (TestCronStartStop) are SKIPped with a pointer to their replacement; crontab parser tests (tools/cron/schedule_test.go) still pass — the parser stays as a validation primitive for settings_model.go. docs/cron-to-tasks.md covers the migration path for services.