queue

package
v0.0.0-...-bdf02af Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CodeSuccess        = 100
	CodeTooManyRequest = 101
)
View Source
const (
	DelayBucket = "later_delay"
	UnackBucket = "later_unack"
	ErrorBucket = "later_error"
)

Variables

View Source
var (
	RedisConnectTimeout  = 50 * time.Millisecond
	RedisReadTimeout     = 50 * time.Millisecond
	RedisWriteTimeout    = 100 * time.Millisecond
	RedisPoolMaxIdle     = 200
	RedisPoolIdleTimeout = 3 * time.Minute
)
View Source
var (
	TaskTTL       = 24 * 3600
	ZrangeCount   = 20
	RetryInterval = 10 //second

	DelayWorkerInterval = 100 * time.Millisecond
	UnackWorkerInterval = 1000 * time.Millisecond
	ErrorWorkerInterval = 1000 * time.Millisecond
)
View Source
var (
	CallbackTTR         = 3 * time.Second //time to run
	MaxIdleConnsPerHost = 10
	MaxIdleConns        = 1024
	IdleConnTimeout     = time.Minute * 5
)

Functions

func InitRedis

func InitRedis(address string) error

func ListenAndServe

func ListenAndServe(addr string) error

func RunWorker

func RunWorker()

func Slice

func Slice(s string) (b []byte)

No copy to change string to slice, use your own risk

func String

func String(b []byte) (s string)

No copy to change slice to string, use your own risk

Types

type Task

type Task struct {
	// ID is a global unique id
	ID string
	// Topic use to classify tasks
	Topic string
	// ExecuteTime is the time to deliver
	ExecuteTime int64
	// MaxRetry is max deliver retry times
	MaxRetry int
	//HasRetry is the current retry times
	HasRetry int
	// Callback is the deliver address
	Callback string
	// Content is the task content to deliver
	Content string
	// CreatTime is the time task created
	CreatTime int64
}

Task is the task to execute

Jump to

Keyboard shortcuts

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