Skip to content

Commit

Permalink
pkg/routine: Use WithoutCancel instead of Transfer
Browse files Browse the repository at this point in the history
  • Loading branch information
monstermunchkin committed Dec 4, 2024
1 parent d7edd29 commit 86ea614
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions pkg/routine/routine.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import (
"github.com/getsentry/sentry-go"
"github.com/pace/bricks/maintenance/errors"
"github.com/pace/bricks/maintenance/log"
pkgcontext "github.com/pace/bricks/pkg/context"
)

type options struct {
Expand Down Expand Up @@ -87,8 +86,8 @@ func RunNamed(parentCtx context.Context, name string, routine func(context.Conte
// thrown in the function are logged and sent to sentry. The routines context is
// canceled if the program receives a shutdown signal (SIGINT, SIGTERM), if the
// returned CancelFunc is called, or if the routine returned.
func Run(parentCtx context.Context, routine func(context.Context)) (cancel context.CancelFunc) {
ctx := pkgcontext.Transfer(parentCtx)
func Run(ctx context.Context, routine func(context.Context)) (cancel context.CancelFunc) {
ctx = context.WithoutCancel(ctx)

// add routine number to context and logger
num := atomic.AddInt64(&ctr, 1)
Expand Down

0 comments on commit 86ea614

Please sign in to comment.