Documentation ¶
Index ¶
Constants ¶
const (
DefaultHandlerDeadline = 30 * time.Second
)
Variables ¶
Functions ¶
func JobFromContext ¶
JobFromContext fetches the job from a context if the job context variable is already set
Types ¶
type CtxVars ¶
type CtxVars struct { Job *jobs.Job // this is a bit hacky. Tx here contains a pgx.Tx for PgBackend, but because we're in the handlers package, and we don't // want all neoq users to have pgx as a transitive dependency, we store Tx as any, and coerce it to a pgx.Tx inside // the postgres backend // TODO redesign HandlerCtxVars so it doesn't need to include a pgx.Tx Tx any }
CtxVars are variables passed to every Handler context
type Handler ¶
Handler handles jobs on a queue
func (*Handler) WithOptions ¶
WithOptions sets one or more options on handler
type Option ¶
type Option func(w *Handler)
Option is function that sets optional configuration for Handlers
func Concurrency ¶
Concurrency configures Neoq handlers to process jobs concurrently the default concurrency is the number of (v)CPUs on the machine running Neoq
func Deadline ¶
Deadline configures handlers with a time deadline for every executed job The deadline is the amount of time that can be spent executing the handler's Func when a deadline is exceeded, the job is failed and enters its retry phase
func MaxQueueCapacity ¶
MaxQueueCapacity configures Handlers to enforce a maximum capacity on the queues that it handles queues that have reached capacity cause Enqueue() to block until the queue is below capacity