refactor: complete graceful shutdown implementation and add service runner (#493)

This commit is contained in:
Alessandro (Ale) Segala
2025-05-03 14:25:22 -07:00
committed by GitHub
parent 6bd6cefaa6
commit bda178c2bb
13 changed files with 454 additions and 130 deletions

View File

@@ -26,7 +26,7 @@ func NewScheduler() (*Scheduler, error) {
// Run the scheduler.
// This function blocks until the context is canceled.
func (s *Scheduler) Run(ctx context.Context) {
func (s *Scheduler) Run(ctx context.Context) error {
log.Println("Starting job scheduler")
s.scheduler.Start()
@@ -39,6 +39,8 @@ func (s *Scheduler) Run(ctx context.Context) {
} else {
log.Println("Job scheduler shut down")
}
return nil
}
func (s *Scheduler) registerJob(ctx context.Context, name string, interval string, job func(ctx context.Context) error) error {