diff --git a/internal/worker/task.go b/internal/worker/task.go index 5246a962..b2588509 100644 --- a/internal/worker/task.go +++ b/internal/worker/task.go @@ -192,6 +192,10 @@ func (worker *Worker) runTask( boundedCtx, cancel := context.WithTimeout(context.Background(), perCallTimeout) defer cancel() + if md, ok := metadata.FromOutgoingContext(ctx); ok { + boundedCtx = metadata.NewOutgoingContext(boundedCtx, md) + } + localHub.WithScope(func(scope *sentry.Scope) { scope.SetTags(cirrusSentryTags) @@ -233,6 +237,10 @@ func (worker *Worker) runTask( boundedCtx, cancel := context.WithTimeout(context.Background(), perCallTimeout) defer cancel() + if md, ok := metadata.FromOutgoingContext(ctx); ok { + boundedCtx = metadata.NewOutgoingContext(boundedCtx, md) + } + if err = upstream.TaskStopped(boundedCtx, api.OldTaskIdentification(taskID, clientSecret)); err != nil { worker.logger.Errorf("failed to notify the server about the stopped task %s: %v", taskID, err)