diff options
| author | 2025-10-17 17:36:24 +0200 | |
|---|---|---|
| committer | 2025-11-17 14:11:11 +0100 | |
| commit | f714b06fec5b93cf076d0f92eeb8aa7c32cfb531 (patch) | |
| tree | 8e1a89dd7b0db0f17b695557d03eede9055134ae /internal/scheduler/scheduler.go | |
| parent | [bugfix] recheck for just-processed-emoji within mutex lock before starting p... (diff) | |
| download | gotosocial-f714b06fec5b93cf076d0f92eeb8aa7c32cfb531.tar.xz | |
[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 <grufwub@gmail.com>
Co-committed-by: kim <grufwub@gmail.com>
Diffstat (limited to 'internal/scheduler/scheduler.go')
| -rw-r--r-- | internal/scheduler/scheduler.go | 12 |
1 files changed, 5 insertions, 7 deletions
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. |
