webstream

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2022 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package webstream provides controls for streaming from the web server.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StreamSource

func StreamSource(ctx context.Context, source gostream.ImageSource, stream gostream.Stream, backoffOpts *BackoffTuningOptions)

StreamSource starts a stream from an image source with a throttled error handler.

Types

type BackoffTuningOptions

type BackoffTuningOptions struct {
	// BaseSleep sets the initial amount of time to wait after an error.
	BaseSleep time.Duration
	// MaxSleep determines the maximum amount of time that streamSource is
	// permitted to a sleep after receiving a single error.
	MaxSleep time.Duration
}

BackoffTuningOptions represents a set of parameters for determining exponential backoff when receiving multiple simultaneous errors.

BaseSleep is the duration to wait after receiving a new error. After that, the wait time doubles for every subsequent, consecutive error of the same type, until the wait duration reaches the MaxSleep duration.

func (*BackoffTuningOptions) GetSleepTimeFromErrorCount

func (opts *BackoffTuningOptions) GetSleepTimeFromErrorCount(errorCount int) time.Duration

GetSleepTimeFromErrorCount returns a sleep time from an error count.

Jump to

Keyboard shortcuts

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