singleflight

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

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

Go to latest
Published: Jan 14, 2025 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrKeyGeneration = errors.New("failed to generate request key")
	ErrHashMethod    = errors.New("failed to hash method and URL")
	ErrHashHeader    = errors.New("failed to hash header")
	ErrReadBody      = errors.New("failed to read request body")
	ErrHashBody      = errors.New("failed to hash body")
)

Functions

This section is empty.

Types

type SingleFlightMiddleware

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

SingleFlightMiddleware implements the singleflight pattern to deduplicate concurrent identical requests.

func New

New creates a new SingleFlightMiddleware instance.

func (*SingleFlightMiddleware) Process

func (m *SingleFlightMiddleware) Process(ctx context.Context, httpClient *http.Client, req *http.Request, next middleware.NextFunc) (*http.Response, error)

Process applies the singleflight pattern before passing the request to the next middleware.

func (*SingleFlightMiddleware) SetLogger

func (m *SingleFlightMiddleware) SetLogger(l logger.Logger)

SetLogger sets the logger for the middleware.

Jump to

Keyboard shortcuts

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