limit

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2026 License: MIT Imports: 3 Imported by: 0 modules, 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 limit runs a function over items a few at a time. It ports manager packages/estimate/src/limit.ts (mapLimit): the estimate's AWS reads, --parallel accounts or a region's workloads.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Map

func Map[T, R any](ctx context.Context, items []T, n int, fn func(context.Context, T) (R, error)) ([]R, error)

Map calls fn over items, at most n at a time (fewer than one: one), and returns the results in the items' order, whatever finishes first.

The first error fails Map, as Node's Promise.all rejects with the first rejection; no further item is started after it (Node's workers go on to the end, their results thrown away) and the context the calls in flight receive is cancelled. A cancelled ctx stops Map the same way and is its error. A call that panics is that item's error, a *Panic with the panic's value (F6: as a Node worker's throw rejects the Promise.all, never a crash of the process).

Types

type Panic

type Panic struct{ Value any }

Panic is a call that panicked: Value is what it panicked with.

func (*Panic) Error

func (p *Panic) Error() string

Error is the panic's value, as fmt prints it (an error's message).

func (*Panic) Unwrap

func (p *Panic) Unwrap() error

Unwrap is the value when it is an error.

Jump to

Keyboard shortcuts

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