v1.2.1

pardnchiu/go-scheduler

Last updated

NoteThis README was generated by SKILL, get the ZH version from here.



SCHEDULE TASKS WITH DEPENDENCIES, TIMEOUTS, AND CRON EXPRESSIONS


Go ReferenceReleaseLicense
Mentioned in Awesome Go




A Go cron scheduler library with task dependency chains, execution timeouts, and graceful shutdown

Table of Contents



Features


go get github.com/pardnchiu/go-scheduler@latest · Documentation

  • Task Dependency Chains — Declare prerequisites with []Wait and choose Stop or Skip when a prerequisite fails.
  • Timeouts and Callbacks — Cap each task's execution time; a timeout fires a callback and marks the task failed.
  • Cron, Descriptors, and Intervals — Mix 5-field cron, descriptors such as @daily, and @every intervals.
  • Min-Heap Event Loop — A min-heap tracks next fire times, so tasks can be added or removed while running.
  • Graceful Shutdown — Stop returns a context that completes only after in-flight tasks finish.

Architecture


Full Architecture

graph TB

    App[Caller] --> Cron[Cron Scheduler]
    Cron --> Parser[Expression Parser]
    Cron --> Heap[Task Min-Heap]
    Heap --> Loop[Event Loop]
    Loop -->|no deps| Runner[Task Execution]
    Loop -->|has deps| Depend[Dependency Subsystem]
    Depend --> Workers[Worker Pool]
    Workers --> Runner
    Runner --> State[State Update]
  1. graph TB
  2. App[Caller] --> Cron[Cron Scheduler]
  3. Cron --> Parser[Expression Parser]
  4. Cron --> Heap[Task Min-Heap]
  5. Heap --> Loop[Event Loop]
  6. Loop -->|no deps| Runner[Task Execution]
  7. Loop -->|has deps| Depend[Dependency Subsystem]
  8. Depend --> Workers[Worker Pool]
  9. Workers --> Runner
  10. Runner --> State[State Update]

License


This project is licensed under the MIT LICENSE.

Author


Just open an issue to share an idea.
go-scheduler contributors


©️ 2025 邱敬幃 Pardn Chiu
中文