Back to godoc.org

Package throttle

v0.0.0 (e2ed998)
Latest Go to latest
Published: Jul 20, 2020 | License: MIT | Module: github.com/albertwidi/gonsq

Index

Package Files

type Throttle

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

Throttle implements gonsq.MiddlewareFunc.

func New

func New(throttleLimit, loosenLimit int) *Throttle

New throttle middleware. Create a new object and initialize the rate-limiter based on the throttleLimit and loosenLimit. This because the gonsq have two level of throttling: throttle and loosenThrottle.

func (*Throttle) Throttle

func (tm *Throttle) Throttle(handler gonsq.HandlerFunc) gonsq.HandlerFunc

Throttle middleware for nsq. This middleware check whether there is some information about throttling in the message.

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier