ctxtimeout

package module
v0.0.0-...-39b1aa1 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

README

CtxTimeout middleware

English | 中文

The ctx timeout middleware allows client timeouts to be controlled through Context.

Notes

  1. When using this middleware, it is necessary to manually add it on the client.
  2. The functionality of this middleware overlaps with that of client.DoDeadline and client.DoTimeout, so only one of them is needed to control the timeout.
  3. For HTTP2, this middleware is the only way to control the timeout, and client.DoDeadline and client.DoTimeout don't work.

Usage

Please refer to the example code: https://github.com/hertz-contrib/ctxtimeout/blob/main/examples

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrTimeout = errors.New(errors.ErrTimeout, errors.ErrorTypePublic, "ctx timeout middleware")
)

Functions

func CtxTimeout

func CtxTimeout(next client.Endpoint) client.Endpoint

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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