safego

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2024 License: Apache-2.0 Imports: 5 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaulSafegoLogger relec.Logger

Functions

func Close

func Close[T any](ch chan T)

func Insert

func Insert[T any](ch chan<- T, value T) bool

func Recovery

func Recovery(exit bool)

Types

type Execution

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

func Run

func Run(f func()) *Execution

Run runs a new goroutine and add panic handler (without restart)

func RunWithRestart

func RunWithRestart(f func()) *Execution

RunWithRestart run a new goroutine and add panic handler: write logs, wait 2 seconds and restart the goroutine

func (*Execution) WithRestartTimeout

func (exec *Execution) WithRestartTimeout(timeout time.Duration) *Execution

type RecoverHandler

type RecoverHandler func(value interface{})
var GlobalRecoverHandler RecoverHandler = func(value interface{}) {}

Jump to

Keyboard shortcuts

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