task

package
v1.10.6 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2020 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init() error

Init will start the service to get all unfinished tasks and run them

func MigrateRepository

func MigrateRepository(doer, u *models.User, opts base.MigrateOptions) error

MigrateRepository add migration repository to task

func Run

func Run(t *models.Task) error

Run a task

Types

type ChannelQueue

type ChannelQueue struct {
	// contains filtered or unexported fields
}

ChannelQueue implements

func NewChannelQueue

func NewChannelQueue(queueLen int) *ChannelQueue

NewChannelQueue create a memory channel queue

func (*ChannelQueue) Push

func (c *ChannelQueue) Push(task *models.Task) error

Push will push the task ID to queue

func (*ChannelQueue) Run

func (c *ChannelQueue) Run() error

Run starts to run the queue

func (*ChannelQueue) Stop

func (c *ChannelQueue) Stop()

Stop stop the queue

type Queue

type Queue interface {
	Run() error
	Push(*models.Task) error
	Stop()
}

Queue defines an interface to run task queue

type RedisQueue

type RedisQueue struct {
	// contains filtered or unexported fields
}

RedisQueue redis queue

func NewRedisQueue

func NewRedisQueue(addrs string, password string, dbIdx int) (*RedisQueue, error)

NewRedisQueue creates single redis or cluster redis queue

func (*RedisQueue) Push

func (r *RedisQueue) Push(task *models.Task) error

Push implements Queue

func (*RedisQueue) Run

func (r *RedisQueue) Run() error

Run starts to run the queue

func (*RedisQueue) Stop

func (r *RedisQueue) Stop()

Stop stop the queue

Jump to

Keyboard shortcuts

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