Search and commands

↑ ↓ to select · Enter to open · Esc to close

Type to search packages.

callbackqueue

v9.24.1
github.com/redis/go-redis/v9/internal/callbackqueue

Documentation

pkg.go.dev ↗

Table of contents

↓ to select · Enter to jump· Shift+Enter for source

5 matches

Top ↑

Functions

RunSafely

func RunSafely(fn func())

RunSafely keeps a panicking callback from crashing the process (callbacks run on a library-owned goroutine) and, when called from drain, from wedging the queue in the draining state. Exported so callers that fan a single dispatched item out to multiple independent callbacks (e.g. a StateChangeCallback loop) can isolate each one without duplicating this recovery logic.

Types

CallbackQueue

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

CallbackQueue runs queued callbacks on a single goroutine, in FIFO order. The drain goroutine is spawned on demand and exits when the queue empties, so an idle queue holds no goroutine.

Convention: name fields of this type `cbq` in every struct that holds one.

CallbackQueue.Dispatch

func (q *CallbackQueue) Dispatch(fn func())

Dependency graph