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.
This commit is contained in:
Boris Nagaev 2024-12-14 00:35:06 -03:00
parent 865da9c525
commit 1750aec13d
No known key found for this signature in database

View file

@ -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 {