merged

package
v0.0.32 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2026 License: Apache-2.0 Imports: 7 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 merged lists a forge's merged PRs page by page within gather's bound, and waits out the forge's rate limits as GitHub says: its retry-after, else until its primary limit resets, else a minute doubling on each repeat, up to a total wait limit. It keeps every PR it listed, even when the forge stops it, so gather can keep what it has, and says how far back a stopped list reached with Stopped.

Index

Constants

View Source
const DefaultLimit = 65 * time.Minute

DefaultLimit is how long List waits in total before it gives up: one full hour of the primary limit plus a few secondary waits.

Variables

This section is empty.

Functions

func List

func List(f forge.MergedPages, since time.Time, max int, w Wait) (prs []forge.PR, more bool, err error)

List returns the PRs merged at or after since, newest merge first, at most max (max 0 or below means no cap). more is true when max stopped the list before since did. It asks f for pages from the first until no page is left or max is reached. When f answers with a *forge.RateLimit it waits as the limit says and asks for the same page again; a wait that would take its total waiting past w.Limit is not slept, and List returns the PRs so far with an error wrapping that limit. Any other error returns the PRs so far and the error.

func Oldest

func Oldest(prs []forge.PR) time.Time

Oldest returns the oldest merge time of prs, the date a list reached back to; zero when prs is empty.

func Read

func Read(f forge.Forge, since time.Time, max int, w Wait) (prs []forge.PR, more bool, reason string, err error)

Read lists through f the PRs merged at or after since, at most max (0 or below means no cap): page by page with List when f offers forge.MergedPages, else in one call to forge.Merged. reason is not empty when PRs are unavailable: f is nil, offers neither, or is unavailable or unauthenticated before it listed any PR. Any other error, or one after PRs were listed, is a *Stopped, with prs holding every PR listed and more false.

Types

type Stopped

type Stopped struct {
	Reached time.Time
	Since   time.Time
	PRs     int
	Err     error
}

Stopped is the error of a list the forge stopped before it reached back to Since: the PRs kept, PRs of them, reach back to Reached (zero when none were listed), and Err is why the forge stopped.

func (*Stopped) Error

func (e *Stopped) Error() string

Error names why the forge stopped, the date the PRs kept reach back to (or that none were listed), the date asked for and how many PRs were kept.

func (*Stopped) Unwrap

func (e *Stopped) Unwrap() error

Unwrap returns why the forge stopped.

type Wait

type Wait struct {
	// Limit is the most List waits in total; DefaultLimit when zero.
	Limit time.Duration
	// Sleep waits for a duration; time.Sleep when nil.
	Sleep func(time.Duration)
	// Now is the current time; time.Now when nil.
	Now func() time.Time
	// Progress, when set, gets one line for each wait, naming the limit and
	// when List resumes.
	Progress io.Writer
}

Wait is how List waits out the forge's rate limits. A zero field means its default.

var Defaults Wait

Defaults stands in for the zero fields of every Wait, before the package's own defaults. It is a seam for the tests of callers that make their own Wait, as init does: they set a short Limit and a Sleep and Now that do not wait. Nothing else sets it.

Jump to

Keyboard shortcuts

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