Help us shape the future of Go! Take the 2026 Go Developer Survey

poller

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package poller runs each view's GitHub query on an interval.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Backoff

func Backoff(base time.Duration, failures int) time.Duration

Backoff returns base × 2^failures, capped at 8× base.

Types

type Poller

type Poller struct {
	// contains filtered or unexported fields
}

func New

func New(s Searcher, views []config.View, interval time.Duration) *Poller

func (*Poller) PollNow

func (p *Poller) PollNow()

PollNow asks Run to start a new round immediately. It never blocks.

func (*Poller) Results

func (p *Poller) Results() <-chan Result

func (*Poller) Run

func (p *Poller) Run(ctx context.Context)

Run polls every view once, then again after each interval (backed off while rounds fail) or when PollNow is called, until ctx is cancelled.

func (*Poller) SetViews

func (p *Poller) SetViews(views []config.View)

SetViews replaces the views to poll and starts a new round now.

type Result

type Result struct {
	View  string
	Query string // the query that produced this result
	PRs   []github.PR
	Err   error
	At    time.Time
}

Result is one view's poll outcome. Err with nil PRs is a failed poll and the caller keeps whatever it showed before; Err with PRs is a warning.

type Searcher

type Searcher interface {
	SearchPRs(ctx context.Context, query string) ([]github.PR, error)
}

Jump to

Keyboard shortcuts

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