From 1750aec13dbaf0b498d760f373df1f596665c73e Mon Sep 17 00:00:00 2001 From: Boris Nagaev Date: Sat, 14 Dec 2024 00:35:06 -0300 Subject: [PATCH] fn: remove uneeded argument of ctxBlocking Removed 'cancel' argument, because it is called only in case the context has already expired and the only action that cancel function did was cancelling the context. --- fn/context_guard.go | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/fn/context_guard.go b/fn/context_guard.go index 3868a3ff0..7c1d5f483 100644 --- a/fn/context_guard.go +++ b/fn/context_guard.go @@ -149,7 +149,7 @@ func (g *ContextGuard) Create(ctx context.Context, } if opts.blocking { - g.ctxBlocking(ctx, cancel) + g.ctxBlocking(ctx) return ctx, cancel } @@ -196,14 +196,10 @@ func (g *ContextGuard) ctxQuitUnsafe(ctx context.Context, } // ctxBlocking spins off a goroutine that will block until the passed context -// is cancelled after which it will call the passed cancel function and -// decrement the wait group. -func (g *ContextGuard) ctxBlocking(ctx context.Context, - cancel context.CancelFunc) { - +// is cancelled after which it will decrement the wait group. +func (g *ContextGuard) ctxBlocking(ctx context.Context) { g.wg.Add(1) go func() { - defer cancel() defer g.wg.Done() select {