sidekiq

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrJobEmptyClass = errors.New("sidekiq: empty job class")
	ErrJobEmptyID    = errors.New("sidekiq: empty job id")
	ErrJobCreatedAt  = errors.New("sidekiq: job created_at should be > 0")
	ErrJobEnqueuedAt = errors.New("sidekiq: job enqueued_at should be > 0")
	ErrJobArgs       = errors.New("sidekiq: job args should be an array")
)

sidekiq job validation errors

View Source
var (
	ErrInvalidQueueID = errors.New("sidekiq: queue id should have format: SIDEKIQ_QUEUE/SIDEKIQ_CLASS")
)

sidekiq queue id validation errors

Functions

func FormatQueueID added in v0.1.11

func FormatQueueID(queue, class string) string

FormatQueueID formats sidekiq queue and class.

func ParseQueueID added in v0.1.11

func ParseQueueID(s string) (string, string, error)

ParseQueueID extracts sidekiq queue and class.

Types

type JobPuller added in v0.1.11

type JobPuller interface {
	Pull(*PullOptions) error
}

JobPuller pulls jobs from sidekiq-compatible queue.

type PullOptions added in v0.1.11

type PullOptions struct {
	Namespace string
	// Used by https://github.com/resque/redis-namespace. By default, it is empty.
	SidekiqNamespace string
	SidekiqQueue     string
}

PullOptions specifies how a job is pulled from sidekiq-compatible queue.

func (*PullOptions) Validate added in v0.1.11

func (opt *PullOptions) Validate() error

Validate validates PullOptions.

type Queue added in v0.1.11

type Queue interface {
	work.RedisQueue
	JobPuller
	work.ExternalEnqueuer
	work.ExternalBulkEnqueuer
	// contains filtered or unexported methods
}

Queue extends RedisQueue, and allows job pulling from sidekiq-compatible queue.

func NewQueue

func NewQueue(client redis.UniversalClient) Queue

NewQueue creates a new queue stored in redis with sidekiq-compatible format.

This assumes that there is another sidekiq instance that is already running, which moves scheduled jobs into corresponding queues. https://github.com/mperham/sidekiq/blob/e3839682a3d219b8a3708feab607c74241bc06b8/lib/sidekiq/scheduled.rb#L12

Enqueued jobs are directly placed on the scheduled job queues. Dequeued jobs are moved to work-compatible queue as soon as they can run immediately.

Jump to

Keyboard shortcuts

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