looper

package
v0.21.1 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2019 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// BlockTime is estimated time needed to create a block in Ethereum.
	BlockTime = time.Second * 15
)

Functions

func AutoOfferingPopUp

func AutoOfferingPopUp(logger log.Logger, abi abi.ABI, db *reform.DB,
	ethBack eth.Backend, timeNowFunc func() time.Time,
	period uint) []*data.Job

AutoOfferingPopUp creates AgentPreOfferingPopUp jobs for active offerings. Taken into account a current balance of agent ETH. If ETH is not enough to pop up all offerings, then no one of them is popped up. Function calculates the pop up time.

func Loop

func Loop(ctx context.Context, logger log.Logger, db *reform.DB,
	queue job.Queue, duration time.Duration, f func() []*data.Job)

Loop performs a function that creates new jobs with a certain frequency. If at the moment there is already a similar active job, then such job is ignored. The function works correctly only with jobs for which duplicates are allowed.

Types

type Config

type Config struct {
	AutoOfferingPopUpTimeout uint64 // In milliseconds.
}

Config is a looper configuration.

func NewConfig

func NewConfig() *Config

NewConfig creates default looper configuration.

Jump to

Keyboard shortcuts

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