Skip to content

pardnchiu/go-queue

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Note

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


PRIORITY-AWARE TASK QUEUE FOR GO

Go Reference Release License Coverage


A Go task queue library with priority scheduling, timeout retries, and an atomic state machine

Table of Contents

Features

go get github.com/pardnchiu/go-queue · Documentation

  • Five-Level Priority Queue — Orders Immediate, High, Retry, Normal, and Low tasks, with automatic promotion after wait timeouts.
  • Worker Pool Parallelism — Defaults to CPU×2 workers with configurable queue capacity and global timeout.
  • Timeout and Retry — Isolates panics, enforces per-task timeouts, and re-enqueues failed tasks at the highest priority.
  • Functional Options — Configures each enqueue with WithTaskID, WithTimeout, WithCallback, and WithRetry.
  • Atomic State Machine — Transitions Created, Running, and Closed via CAS for lock-free, idempotent Shutdown.

Architecture

Full Architecture

graph TB
    App[Application] --> Enqueue[Enqueue]
    Enqueue --> Pending[Pending Heap]
    Pending --> Workers[Worker Pool]
    Workers --> Execute[Execute / Timeout / Retry]
    App --> Start[Start]
    App --> Shutdown[Shutdown]
    Start --> Workers
    Shutdown --> Pending
Loading

License

This project is licensed under the MIT LICENSE.

Author

邱敬幃 Pardn Chiu

hi@pardn.io
https://www.linkedin.com/in/pardnchiu


©️ 2025 邱敬幃 Pardn Chiu

About

(module) A Go task queue library with priority scheduling, timeout retries, and an atomic state machine

Topics

Resources

License

Stars

7 stars

Watchers

0 watching

Forks

Contributors

Languages