utils

package
v0.0.0-...-07b9e35 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2021 License: OSL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContextIsDone

func ContextIsDone(ctx context.Context) bool

ContextIsDone returns true if the supplied context is reporting that it is done.

func GetShuffledIntList

func GetShuffledIntList(size int) []int

GetShuffledIntList returns a list of contiguous sudo-randomly shuffled integers n, where n[i] is in [1, size].

func Logf

func Logf(format string, v ...interface{}) chromedp.Action

Logf is an adapter for `log.Printf` which can be used as a chromedp.Action.

Types

type Pacer

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

A Pacer provides a means of pausing program execution for a period of time.

func SetNormalPace

func SetNormalPace(mu, sigma float64, basis time.Duration) *Pacer

SetNormalPace returns a Pace where mu is the average wait time, sigma is the standard deviation of the wait time, and basis is the wait-time unit duration.

func SetUniformPace

func SetUniformPace(min, max float64, basis time.Duration) *Pacer

SetUniformPace returns a pace where the wait time is uniformly distributed between min and max, and basis is the wait-time unit duration.

func (*Pacer) Wait

func (p *Pacer) Wait()

Wait blocks until the time since the last call has exceeded a minimum pacing duration. The pace duration is centered around a mean wait time plus or minus a normally distributed jitter period.

Jump to

Keyboard shortcuts

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