runnerinstance

package
v1.21.0 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2022 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var HeartbeatInterval = time.Second * 30

HeartbeatInterval is the duration between an instance's heartbeats a heartbeat is a sign of life, committed to DB, for an instance to assert that it is still active useful to discriminate tasks acquired by a defunct instance

Functions

func Create

func Create(dbp zesty.DBProvider) (id uint64, err error)

Create inserts a new instance object in DB, sets its heartbeat routine in motion

Types

type Instance

type Instance struct {
	ID        uint64    `db:"id"`
	Heartbeat time.Time `db:"heartbeat"`
}

Instance represents one active instance of µTask with its ID acquired from DB, and its latest heartbeat timestamp

func ListInstances

func ListInstances(dbp zesty.DBProvider) (ii []*Instance, err error)

ListInstances returns a list of µTask instances from DB

func (*Instance) Delete

func (i *Instance) Delete(dbp zesty.DBProvider) error

Delete removes a µTask instance from DB

func (*Instance) IsDead

func (i *Instance) IsDead() bool

IsDead asserts that an instance is dead (hasn't emitted a heartbeat for longer than twice the heartbeat interval)

Jump to

Keyboard shortcuts

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