From f714b06fec5b93cf076d0f92eeb8aa7c32cfb531 Mon Sep 17 00:00:00 2001 From: kim Date: Fri, 17 Oct 2025 17:36:24 +0200 Subject: [chore] update dependencies (#4507) - codeberg.org/gruf/go-runners: v1.6.3 -> v1.7.0 - codeberg.org/gruf/go-sched: v1.2.4 -> v1.3.0 - github.com/tdewolff/minify/v2: v2.24.3 -> v2.24.4 Reviewed-on: https://codeberg.org/superseriousbusiness/gotosocial/pulls/4507 Co-authored-by: kim Co-committed-by: kim --- internal/scheduler/scheduler.go | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'internal/scheduler/scheduler.go') diff --git a/internal/scheduler/scheduler.go b/internal/scheduler/scheduler.go index 8ef595dc4..b021cc137 100644 --- a/internal/scheduler/scheduler.go +++ b/internal/scheduler/scheduler.go @@ -37,7 +37,7 @@ type Scheduler struct { // Start attempts to start the scheduler. Returns false if already running. func (sch *Scheduler) Start() bool { - if sch.sch.Start(nil) { + if sch.sch.Start() { sch.ts = make(map[string]*task) return true } @@ -89,7 +89,7 @@ func (sch *Scheduler) schedule(id string, fn func(context.Context, time.Time), t panic("nil function") } - // Perform within lock. + // Acquire lock. sch.mu.Lock() defer sch.mu.Unlock() @@ -99,16 +99,14 @@ func (sch *Scheduler) schedule(id string, fn func(context.Context, time.Time), t return false } - // Extract current sched context. - doneCh := sch.sch.Done() - ctx := runners.CancelCtx(doneCh) + // Extract current scheduler context. + ctx := runners.CancelCtx(sch.sch.Done()) // Create a new job to hold task function with // timing, passing in the current sched context. job := sched.NewJob(func(now time.Time) { fn(ctx, now) - }) - job.With(t) + }).With(t) // Queue job with the scheduler, // and store a new encompassing task. -- cgit v1.2.3