timeout

package
v0.17.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

timeouts.go implements adaptive timeout management for HTTP requests to Starknet nodes. This file handles dynamic timeout adjustments based on request performance, automatically scaling timeouts up or down depending on success/failure rates.

Index

Constants

View Source
const (
	DefaultTimeouts     = "5s"
	MediumGrowThreshold = 2 * time.Minute
)

Variables

This section is empty.

Functions

func HTTPTimeoutsSettings

func HTTPTimeoutsSettings(w http.ResponseWriter, r *http.Request, clients ...Client)

func ParseTimeouts

func ParseTimeouts(value string) ([]time.Duration, bool, error)

ParseTimeouts parses a comma-separated string of duration values into a slice of time.Duration. Returns: - the parsed timeout values - if a fixed or dynamic timeouts should be used - an error in case the string cannot be parsed

Types

type Client

type Client interface {
	Timeouts() string
	SetTimeouts(timeouts []time.Duration, fixed bool)
}

type Timeouts

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

func Default

func Default() Timeouts

func New

func New(timeouts []time.Duration, fixed bool) *Timeouts

func (*Timeouts) DecreaseTimeout

func (t *Timeouts) DecreaseTimeout()

func (*Timeouts) GetCurrentTimeout

func (t *Timeouts) GetCurrentTimeout() time.Duration

func (*Timeouts) IncreaseTimeout

func (t *Timeouts) IncreaseTimeout()

func (*Timeouts) String

func (t *Timeouts) String() string

Jump to

Keyboard shortcuts

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