redis

package
v0.43.0 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2023 License: AGPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidAddr = errors.New("invalid connecton string: see documentation for valid connection strings")

ErrInvalidAddr indicates that the provided address is not a valid redis connection string

Functions

func Backend

func Backend(_ context.Context, opts ...neoq.ConfigOption) (backend neoq.Neoq, err error)

Backend is a neoq.BackendInitializer that initializes a new Redis-backed neoq backend

func WithAddr

func WithAddr(addr string) neoq.ConfigOption

WithAddr configures neoq to connect to Redis with the given address

func WithConcurrency

func WithConcurrency(concurrency int) neoq.ConfigOption

WithConcurrency configures the number of workers available to process jobs across all queues

func WithPassword

func WithPassword(password string) neoq.ConfigOption

WithPassword configures neoq to connect to Redis with the given password

func WithShutdownTimeout

func WithShutdownTimeout(timeout time.Duration) neoq.ConfigOption

WithShutdownTimeout specifies the duration to wait to let workers finish their tasks before forcing them to abort durning Shutdown()

If unset or zero, default timeout of 8 seconds is used.

Types

type RedisBackend added in v0.16.0

type RedisBackend struct {
	neoq.Neoq
	// contains filtered or unexported fields
}

RedisBackend is a Redis-backed neoq backend nolint: revive

func (*RedisBackend) Enqueue added in v0.16.0

func (b *RedisBackend) Enqueue(ctx context.Context, job *jobs.Job) (jobID string, err error)

Enqueue queues jobs to be executed asynchronously

func (*RedisBackend) SetLogger added in v0.16.0

func (b *RedisBackend) SetLogger(logger logging.Logger)

SetLogger sets this backend's logger

func (*RedisBackend) Shutdown added in v0.16.0

func (b *RedisBackend) Shutdown(ctx context.Context)

Shutdown halts the worker

func (*RedisBackend) Start added in v0.16.0

func (b *RedisBackend) Start(_ context.Context, h handler.Handler) (err error)

Start starts processing jobs with the specified queue and handler

func (*RedisBackend) StartCron added in v0.16.0

func (b *RedisBackend) StartCron(ctx context.Context, cronSpec string, h handler.Handler) (err error)

StartCron starts processing jobs with the specified cron schedule and handler

See: https://pkg.go.dev/github.com/robfig/cron?#hdr-CRON_Expression_Format for details on the cron spec format

Jump to

Keyboard shortcuts

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