queue

package
v0.0.73 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2018 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// DefaultPriority is the default priority for tasks
	DefaultPriority = Priority(0)

	// HighPriority is the highest priority for tasks
	HighPriority = Priority(-10000000)

	// LowPriority is the lowest priority for tasks
	LowPriority = Priority(+10000000)
)

Variables

This section is empty.

Functions

func AddTask

func AddTask(rc redis.Conn, queue string, taskType string, orgID int, task interface{}, priority Priority) error

AddTask adds the passed in task to our queue for execution

func MarkTaskComplete

func MarkTaskComplete(rc redis.Conn, queue string, orgID int) error

MarkTaskComplete marks the passed in task as complete. Callers must call this in order to maintain fair workers across orgs

Types

type Priority

type Priority int

Priority is the priority for the task

type Task

type Task struct {
	Type  string          `json:"type"`
	OrgID int             `json:"org_id"`
	Task  json.RawMessage `json:"task"`
}

Task is a utility struct for encoding a task

func PopNextTask

func PopNextTask(rc redis.Conn, queue string) (*Task, error)

PopNextTask pops the next task off our queue

Jump to

Keyboard shortcuts

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