restore

package
v1.0.2-rc1 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const DelayFieldName = "runner.middleware.restore.delay"

DelayFieldName — имя поля для задержки между попытками.

Variables

View Source
var Component = compogo.Component{
	Name: "runner.middleware.restore",
	Dependencies: compogo.Components{
		&runner.Component,
	},
	Init: compogo.StepFunc(func(container compogo.Container) error {
		return container.Provides(NewConfig, NewRestore)
	}),
	BindFlags: compogo.BindFlags(func(flagSet flag.FlagSet, container compogo.Container) error {
		return container.Invoke(func(config *Config) {
			flagSet.DurationVar(&config.Delay, DelayFieldName, DelayDefault, "")
		})
	}),
	Configuration: compogo.StepFunc(func(container compogo.Container) error {
		return container.Invoke(Configuration)
	}),
	PreExecute: compogo.StepFunc(func(container compogo.Container) error {
		return container.Invoke(func(r runner.Runner, middleware *Restore) {
			r.Use(middleware)
		})
	}),
}

Component — компонент middleware восстановления для runner.Runner.

View Source
var DelayDefault = 100 * time.Millisecond

DelayDefault — задержка по умолчанию (100 мс).

Functions

This section is empty.

Types

type Config

type Config struct {
	Delay time.Duration
}

Config содержит конфигурацию middleware восстановления.

func Configuration

func Configuration(config *Config, configurator compogo.Configurator) *Config

Configuration загружает конфигурацию из Configurator.

func NewConfig

func NewConfig() *Config

NewConfig создаёт новую конфигурацию.

type Restore

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

Restore — middleware для автоматического восстановления процессов. При ошибке выполнения процесса перезапускает его с задержкой. Работает до тех пор, пока не будет отменён контекст.

func NewRestore

func NewRestore(config *Config) *Restore

func (*Restore) Middleware

func (restore *Restore) Middleware(_ runner.Process, next runner.ProcessFunc) runner.ProcessFunc

Jump to

Keyboard shortcuts

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