thread

package
v0.9.3 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Thread

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

Thread provides a background, periodic thread, which invokes the given function every supplied interval.

Sample usage:

monitorFunc := func() {
    //do monitoring logic
}
monitor := thread.New(log, "Health Monitor", time.Minute*2, monitorFunc)
monitor.Start()
defer monitor.Stop()
....

func New

func New(ctx context.Context, log logrus.FieldLogger, name string, interval time.Duration, exec func(context.Context)) *Thread

func (*Thread) LastRunStartedAt

func (t *Thread) LastRunStartedAt() time.Time

func (*Thread) Name

func (t *Thread) Name() string

func (*Thread) Start

func (t *Thread) Start()

Start thread

func (*Thread) Stop

func (t *Thread) Stop()

Stop thread

Jump to

Keyboard shortcuts

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