Help us shape the future of Go! Take the 2026 Go Developer Survey

cronjob

package
v0.320.0 Latest Latest
Warning

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

Go to latest
Published: May 25, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CronJobFiredPayload

type CronJobFiredPayload struct {
	JobName string
	TaskID  string
}

CronJobFiredPayload is published via pubsub whenever a scheduled or manual cronjob dispatch succeeds and a Mesnada task has been created.

type JobStatus

type JobStatus struct {
	config.CronJob
	NextRun time.Time `json:"nextRun,omitempty"`
}

type OrchestratorClient

type OrchestratorClient interface {
	Spawn(ctx context.Context, req mesnadamodels.SpawnRequest) (*mesnadamodels.Task, error)
	ListTasks(req mesnadamodels.ListRequest) ([]*mesnadamodels.Task, error)
}

type Service

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

func NewService

func NewService(orchestrator OrchestratorClient, workDir string, logger *slog.Logger) *Service

func (*Service) ListJobs

func (s *Service) ListJobs() []JobStatus

func (*Service) Reload

func (s *Service) Reload(cfg config.CronJobsConfig) error

func (*Service) RunNow

func (s *Service) RunNow(ctx context.Context, name string) (*mesnadamodels.Task, error)

func (*Service) Start

func (s *Service) Start(ctx context.Context, cfg config.CronJobsConfig) error

func (*Service) Stop

func (s *Service) Stop()

func (*Service) Subscribe

func (s *Service) Subscribe(ctx context.Context) <-chan pubsub.Event[CronJobFiredPayload]

Subscribe returns a channel that emits CronJobFiredPayload events whenever a cronjob dispatch succeeds. The channel is closed when ctx is cancelled.

Jump to

Keyboard shortcuts

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