newContext creates a new context for a new Task iteration.
(t Task)
| 210 | |
| 211 | // newContext creates a new context for a new Task iteration. |
| 212 | func (q *queue) newContext(t Task) context.Context { |
| 213 | l := q.logger.CopyWithPrefix(fmt.Sprintf("[Cid: %s TaskID: %d Queue: %s]", t.CorrelationID(), t.ID(), q.name)) |
| 214 | ctx := q.dep.ForkWithLogger(q.rootCtx, l) |
| 215 | ctx = context.WithValue(ctx, logging.CorrelationIDCtx{}, t.CorrelationID()) |
| 216 | ctx = context.WithValue(ctx, logging.LoggerCtx{}, l) |
| 217 | ctx = context.WithValue(ctx, inventory.UserCtx{}, t.Owner()) |
| 218 | return ctx |
| 219 | } |
| 220 | |
| 221 | func (q *queue) work(t Task) { |
| 222 | ctx := q.newContext(t) |
no test coverage detected