> [!NOTE]
> This README was generated by [SKILL](https://github.com/agenvoy/skill-readme-generate), get the ZH version from [here](https://github.com/pardnchiu/go-scheduler/blob/main/doc/README.zh.md).

---

<p align="center">
<strong>SCHEDULE TASKS WITH DEPENDENCIES, TIMEOUTS, AND CRON EXPRESSIONS</strong>
</p>

<p align="center">
<a href="https://pkg.go.dev/github.com/pardnchiu/go-scheduler/core"><img src="https://img.shields.io/badge/GO-REFERENCE-blue?include_prereleases&style=for-the-badge" alt="Go Reference"></a>
<a href="https://github.com/pardnchiu/go-scheduler/releases"><img src="https://img.shields.io/github/v/tag/pardnchiu/go-scheduler?include_prereleases&style=for-the-badge" alt="Release"></a>
<a href="https://github.com/pardnchiu/go-scheduler/blob/main/LICENSE"><img src="https://img.shields.io/github/license/pardnchiu/go-scheduler?include_prereleases&style=for-the-badge" alt="License"></a><br>
<a href="https://github.com/avelino/awesome-go"><img src="https://awesome.re/mentioned-badge.svg" height="40" alt="Mentioned in Awesome Go"></a>
</p>

---

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

## Table of Contents

- [Features](#features)
- [Architecture](#architecture)
- [License](#license)
- [Author](#author)

## Features

> `go get github.com/pardnchiu/go-scheduler@latest` · [Documentation](https://github.com/pardnchiu/go-scheduler/blob/main/doc/doc.md)

- **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](https://github.com/pardnchiu/go-scheduler/blob/main/doc/architecture.md)

```mermaid
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]
```

## License

This project is licensed under the [MIT LICENSE](https://github.com/pardnchiu/go-scheduler/blob/main/LICENSE).

## Author

Just [open an issue](https://github.com/pardnchiu/go-scheduler/issues/new) to share an idea.

<a href="https://github.com/pardnchiu/go-scheduler/graphs/contributors">
  <img src="https://contrib.rocks/image?repo=pardnchiu/go-scheduler&cache_bust=2026-10-07" alt="go-scheduler contributors" />
</a>

---

©️ 2025 [邱敬幃 Pardn Chiu](https://www.linkedin.com/in/pardnchiu)
