middleware

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Wait

func Wait(wait time.Duration) func(func(context.Context)) func(context.Context)

Wait will add a pause interval between calls to the next job. The pause affects only jobs between the same worker.

Types

type Counter

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

Counter count how many jobs have started and finished.

func (*Counter) Finished

func (c *Counter) Finished() uint64

func (*Counter) Middleware

func (c *Counter) Middleware() func(func(context.Context)) func(context.Context)

func (*Counter) Started

func (c *Counter) Started() uint64

type Elapsed

type Elapsed struct {
	Counter
	// contains filtered or unexported fields
}

Elapsed is a job middleware that extends the simple counter and calculates the the total time, average time and the last time spent doing the job.

func (*Elapsed) Average

func (e *Elapsed) Average() time.Duration

func (*Elapsed) Last

func (e *Elapsed) Last() time.Duration

func (*Elapsed) Middleware

func (e *Elapsed) Middleware() func(func(context.Context)) func(context.Context)

func (*Elapsed) Total

func (e *Elapsed) Total() time.Duration

Jump to

Keyboard shortcuts

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