routines

package
v0.0.0-...-25e8c23 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NotificationsMqttPath = "notifications"
	EventsMqttPath        = "events"

	QosAtMostOnce  = 0
	QosAtLeastOnce = 1
	QosExactlyOnce = 2
)

Variables

View Source
var (
	ErrRoutineNotFound = errors.New("routine not found")
)

Functions

This section is empty.

Types

type Scheduler

type Scheduler struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Scheduler holds the routines and their triggers. When a trigger event is raised

func NewScheduler

func NewScheduler(db *pg.DB, maxConcurrentWorkers int, host string, retry int) *Scheduler

func (*Scheduler) Run

func (s *Scheduler) Run(interval time.Duration)

Run will periodically check at the specified interval rate if actions should run. Let's say interval is 10 seconds, this means that every 10 seconds we'll check if an action should run.

func (*Scheduler) Trigger

func (s *Scheduler) Trigger(id int64) error

func (*Scheduler) UpdateRoutines

func (s *Scheduler) UpdateRoutines() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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