safego

package
v0.0.0-...-4bafeee Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2026 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Overview

Package safego runs background goroutines that cannot take the process down with them.

Fiber's recover middleware only covers the goroutine handling the request. Anything launched with a bare `go func()` - a federation delivery, a fan-out over rooms - is on its own: one nil dereference on an unexpected response, and every connected user's API disappears. That is a much worse outcome than one background task failing, so every goroutine that outlives or runs beside a request goes through here instead.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Go

func Go(tag string, fn func())

Go runs fn on a new goroutine, logging a panic under `tag` instead of crashing.

func Run

func Run(tag string, fn func())

Run calls fn on the current goroutine with the same panic protection as Go. For use inside an existing goroutine (a WaitGroup worker, for instance) that must not escape.

Types

This section is empty.

Jump to

Keyboard shortcuts

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