loops

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: Apache-2.0 Imports: 5 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package loops runs a library's long-lived loops under the caller's wait group with the posture the node's supervisor gives a Degrade loop: a panic is absorbed and logged with its stack, and a return before the context ends is logged, each with the loop's name. No pkg/ package imports the supervisor, so the topology provider and the resident applications start their loops here. A goroutine started per peer, connection, or flow ends with what it serves, so it joins the wait group through the group's own Go. Sleep is the pause between any loop's passes, cut short when the loop's context ends.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Go

func Go(ctx context.Context, wg *sync.WaitGroup, name string, fn func(context.Context))

Go runs fn in its own goroutine under wg, passing it ctx. A panic in fn is absorbed and logged with the stack, and a return before ctx ends is logged: a loop runs until ctx ends.

func Sleep

func Sleep(ctx context.Context, d time.Duration) bool

Sleep pauses for d and reports whether the pause ran its course: false once ctx has ended, before the pause or during it, so a loop returns on false.

Types

This section is empty.

Jump to

Keyboard shortcuts

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