taskqueue

package
v1.6.5 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2017 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package taskqueue provides the functionality for receiving, handling and executing tasks. In this file are the routines for the task-structs used in the taskqueue.

Package taskqueue provides the functionality for receiving, handling and executing tasks. In this file are the routines for the taskqueue itself.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Start

func Start(c config.Config)

Start initialises several variables and creates necessary go-routines

func Stop

func Stop()

Stop will cause the taskqueue to stop accepting new tasks and shutdown the worker routines after they've finished their current tasks

func Wait

func Wait()

Wait waits, to keep the application running as long as there are workers

Types

type QueueTask

type QueueTask struct {
	Args         []string          `json:"args"`                    // list of arguments passed to script/application as argument in the given order
	Env          map[string]string `json:"env"`                     // map containing environment variables passed to script/application
	ErrorMessage string            `json:"error_message,omitempty"` // error message that might be created on executing the task
}

A QueueTask is the task as it is enqueued in a Redis-list.

func NewQueueTask

func NewQueueTask(redisValue string) (task QueueTask, err error)

NewQueueTask returns an instance of QueueTask from the passed value.

func (QueueTask) Execute

func (q QueueTask) Execute(script string) error

Execute executes the passed script/application with the arguments from the QueueTask object.

func (QueueTask) GetJSONString

func (q QueueTask) GetJSONString() (value string, err error)

GetJSONString returns the QueueTask object as a json-encoded string

Jump to

Keyboard shortcuts

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