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 --- vendor/codeberg.org/gruf/go-runners/context.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'vendor/codeberg.org/gruf/go-runners/context.go') diff --git a/vendor/codeberg.org/gruf/go-runners/context.go b/vendor/codeberg.org/gruf/go-runners/context.go index 12f7f1a10..e02dcab22 100644 --- a/vendor/codeberg.org/gruf/go-runners/context.go +++ b/vendor/codeberg.org/gruf/go-runners/context.go @@ -2,6 +2,7 @@ package runners import ( "context" + "sync/atomic" "time" ) @@ -19,9 +20,13 @@ func Closed() context.Context { // CtxWithCancel returns a new context.Context impl with cancel. func CtxWithCancel() (context.Context, context.CancelFunc) { + var once atomic.Uint32 ctx := make(chan struct{}) - cncl := func() { close(ctx) } - return CancelCtx(ctx), cncl + return CancelCtx(ctx), func() { + if once.CompareAndSwap(0, 1) { + close(ctx) + } + } } // CancelCtx is the simplest possible cancellable context. -- cgit v1.2.3