supervised

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2019 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package supervised provides basic supervision abilities for running goroutines, namely making sure that panics are not swallowed and that long-running goroutines are restarted if they crash

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GoOnce

func GoOnce(errorer Errorer, f func())

Runs f() in a new goroutine; if it panics, logs the error and stack trace to the specified Errorer

func Recover added in v0.7.11

func Recover(errorer Errorer, f func())

Runs f() on the original goroutine; if it panics, logs the error and stack trace to the specified Errorer Very similar to GoOnce except doesn't start a new goroutine

Types

type ContextEndedChan

type ContextEndedChan chan struct{}

func GoForever

func GoForever(ctx context.Context, logger Errorer, f func()) ContextEndedChan

Runs f() in a new goroutine; if it panics, logs the error and stack trace to the specified Errorer If the provided Context isn't closed, re-runs f() Returns a channel that is closed when the goroutine has quit due to context ending

type Errorer

type Errorer interface {
	Error(message string, fields ...*log.Field)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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