Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions celery.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,8 @@ type contextKey int
const (
// ContextKeyTaskName is a context key to access task names.
ContextKeyTaskName contextKey = iota
// ContextKeyTaskID is a context key to access task IDs.
ContextKeyTaskID
)

// executeTask calls the task function with args and kwargs from the message.
Expand All @@ -304,6 +306,7 @@ func (a *App) executeTask(ctx context.Context, m *protocol.Task) (err error) {
}

ctx = context.WithValue(ctx, ContextKeyTaskName, m.Name)
ctx = context.WithValue(ctx, ContextKeyTaskID, m.ID)
p := NewTaskParam(m.Args, m.Kwargs)
return task(ctx, p)
}