mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-08-30 17:13:08 +08:00
fix: Workmanager delayTaskWithoutReqctx
The context of delayTaskWithoutReqctx should have 'taskid' value.
This commit is contained in:
@@ -111,8 +111,12 @@ func (w *SWorkManager) DelayTaskWithoutReqctx(ctx context.Context, task DelayTas
|
||||
func (w *SWorkManager) delayTaskWithoutReqctx(
|
||||
ctx context.Context, task DelayTaskFunc, params interface{}, worker *appsrv.SWorkerManager,
|
||||
) {
|
||||
// delayTaskWithReqctx should have a new context.Context
|
||||
ctx = context.Background()
|
||||
// delayTaskWithoutReqctx should have a new context.Context
|
||||
newCtx := context.Background()
|
||||
if ctx != nil && ctx.Value(appctx.APP_CONTEXT_KEY_TASK_ID) != nil {
|
||||
newCtx = context.WithValue(newCtx, appctx.APP_CONTEXT_KEY_TASK_ID, ctx.Value(appctx.APP_CONTEXT_KEY_TASK_ID))
|
||||
}
|
||||
ctx = newCtx
|
||||
w.add()
|
||||
w.worker.Run(func() {
|
||||
defer w.done()
|
||||
|
||||
Reference in New Issue
Block a user