bounded

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package bounded runs a call that cannot be cancelled under a context that can.

It exists because the OS keychain APIs this module wraps — Keychain Services, Secret Service over D-Bus, Windows Credential Manager — are synchronous and expose no cancellation, and at least one of them can block indefinitely: a locked Secret Service collection waits on an unlock prompt, which on a headless host nobody can answer. Without this, a caller's deadline is decoration.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(ctx context.Context, fn func() error) error

Run calls fn and returns either fn's error or the context's, whichever arrives first.

When the context wins, **the call is abandoned rather than stopped**: fn's goroutine keeps running until the underlying operation returns, which for a blocked keychain means until the prompt is answered, the keyring is unlocked, or the daemon exits. That is a bounded leak and it is the honest cost of bounding an uncancellable call — cancellation returns control to the caller, it does not stop the work. A process that cancels in a tight loop against a blocked keychain will accumulate goroutines.

It is still strictly better than the alternative, where the caller is the thing that never returns.

Types

This section is empty.

Jump to

Keyboard shortcuts

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