Skip to content

Commit

Permalink
fn: remove uneeded argument of ctxBlocking
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
starius committed Dec 14, 2024
1 parent 22eee50 commit 358a65a
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions fn/context_guard.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ func (g *ContextGuard) Create(ctx context.Context,
}

if opts.blocking {
g.ctxBlocking(ctx, cancel)
g.ctxBlocking(ctx)

return ctx, cancel
}
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 358a65a

Please sign in to comment.