queue

package
v2.0.17 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultOptions = func() Options {
		return Options{
			MaxRetry:        16,
			FetchCheckSec:   5,
			FetchForwardSec: 60,
			FetchPerCount:   128,
			RetryCheckSec:   60,
			RetryForwardSec: 600,
			RetryPerCount:   1024,
		}
	}
)
View Source
var (
	ErrNoneHandler = errors.New(`not found handler, please register handler`)
)

Functions

This section is empty.

Types

type Delay

type Delay interface {
	Set(ctx context.Context, item Item) (err error)
	SetDead(ctx context.Context, item Item) (err error)
	Done(ctx context.Context, items ...Item) (err error)
	DeadList(ctx context.Context, offset, count int64) (items []Item, err error)
	RegisterHandler(handler Handler)
	Start() error
	Stop(timeout time.Duration) error
}

func NewDelay

func NewDelay(key string, red *redis.Client, opt Options) Delay

func NewDelayWithGoPool

func NewDelayWithGoPool(key string, red *redis.Client, pool *gopool.Pool, opt Options) Delay

type Handler

type Handler func(items []Item)

type Item

type Item struct {
	Id         string `json:"i"`
	Name       string `json:"n"`
	At         int64  `json:"a"`
	RetryCount int64  `json:"rc"`
}

func (*Item) Member

func (i *Item) Member() string

type Options

type Options struct {
	MaxRetry        int64 `json:"maxRetry" yaml:"maxRetry"`
	FetchCheckSec   int64 `json:"fetchCheckSec" yaml:"fetchCheckSec"`
	FetchPerCount   int64 `json:"fetchPerCount" yaml:"fetchPerCount"`
	FetchForwardSec int64 `json:"fetchForwardSec" yaml:"fetchForwardSec"`
	RetryCheckSec   int64 `json:"retryCheckSec" yaml:"retryCheckSec"`
	RetryPerCount   int64 `json:"retryPerCount" yaml:"retryPerCount"`
	RetryForwardSec int64 `json:"retryForwardSec" yaml:"retryForwardSec"`
}

func (*Options) FetchCheck

func (o *Options) FetchCheck() time.Duration

func (*Options) FetchForwardBeginAt

func (o *Options) FetchForwardBeginAt(now int64) int64

func (*Options) RetryCheck

func (o *Options) RetryCheck() time.Duration

func (*Options) RetryForwardEndAt

func (o *Options) RetryForwardEndAt(now int64) int64

Jump to

Keyboard shortcuts

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