Help us shape the future of Go! Take the 2026 Go Developer Survey

local

package
v0.2.50 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2026 License: MPL-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package local is the in-process cron Queue: a buffered channel feeding a fixed pool of worker goroutines. Single-node default — preserves the chassis's "fire and drain per dispatch" behavior, but bounds how many dispatches run at once (a fan-out of N slow tenants can't spawn N unbounded goroutines). Selected with --cron-queue=local (the default).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Queue

type Queue struct {
	// contains filtered or unexported fields
}

Queue is the in-process cron Queue.

func (*Queue) Enqueue

func (q *Queue) Enqueue(ctx context.Context, job cron.Job) error

Enqueue sends a job onto the buffered channel. Honors ctx so a shutting-down scheduler doesn't block forever on a full buffer (a full buffer is intended backpressure — the worker pool hasn't drained the previous fan-out).

func (*Queue) Name

func (*Queue) Name() string

func (*Queue) Work

func (q *Queue) Work(ctx context.Context, fn func(context.Context, cron.Job) error) error

Work starts q.max worker goroutines, each pulling jobs and calling fn synchronously. Receiving a job off the channel is the at-most-one-worker guarantee — no separate semaphore, no goroutine-per-job. Work returns after ctx is cancelled and every worker has finished its current fn.

Jump to

Keyboard shortcuts

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