tickque

package module
v0.0.0-...-bf3229e Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2022 License: BSD-3-Clause Imports: 10 Imported by: 13

README

tickque

A job queue designed especially for server tick/update/heartbeat.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Recycle

func Recycle(job *Job)

Types

type Job

type Job struct {
	Type string
	Data live.Data
	// contains filtered or unexported fields
}

func (*Job) Hint

func (j *Job) Hint() int64

func (*Job) RetryNumber

func (j *Job) RetryNumber() int32

type JobHandler

type JobHandler func(job *Job) error

type Option

type Option func(tq *Tickque)

func WithMaxTickTime

func WithMaxTickTime(d time.Duration) Option

func WithNumBurstThreads

func WithNumBurstThreads(n int) Option

type Tickque

type Tickque struct {
	slog.Logger
	// contains filtered or unexported fields
}

func NewTickque

func NewTickque(logger slog.Logger, opts ...Option) (tq *Tickque)

func (*Tickque) AddBurstJob

func (tq *Tickque) AddBurstJob(hint int64, jobType string, jobData live.Data)

func (*Tickque) AddJob

func (tq *Tickque) AddJob(jobType string, jobData live.Data)

func (*Tickque) NumPendingJobs

func (tq *Tickque) NumPendingJobs() int

func (*Tickque) Postpone

func (tq *Tickque) Postpone(job *Job)

func (*Tickque) Shutdown

func (tq *Tickque) Shutdown(ctx context.Context, jobHandler JobHandler) (int, error)

func (*Tickque) Tick

func (tq *Tickque) Tick(maxJobs int, jobHandler JobHandler) int

Jump to

Keyboard shortcuts

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