queue

command
v0.12.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 12, 2026 License: MIT Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README ¶

Queue (Redis-based) Module

Overview

The queue module provides a distributed task queue built on top of Redis. It relies on the generic worker pool and scheduler mechanism to execute background jobs securely and concurrently.

Key Structs & Configs

  • queue.Config: Configurations for the queue workers.
    • Concurrency: Number of worker goroutines (Default: 10).
    • ShutdownTimeout: Duration to wait for in-flight jobs to complete during q.Stop() before forcing exit.
  • registry: A central package to register tasks (registry.Register(...)) via init() blocks.

🚨 Best Practices for AI/Developers

  • Task Registration: Tasks should be registered in their own packages using init() to keep the codebase modular. You MUST use blank imports in main.go (e.g., _ "github.com/.../tasks") to trigger the init() functions.
  • Graceful Shutdown (CRITICAL): Always intercept OS signals (SIGINT, SIGTERM) and call q.Stop() in a separate goroutine to allow the workers to drain safely within the ShutdownTimeout window.
  • Dependency Loading: Ensure Redis is connected and initialized (gored.SetDefault) before calling queue.New(rdb, config).

Documentation ¶

The Go Gopher

There is no documentation for this package.

Directories ¶

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL