MCPcopy Create free account
hub / github.com/devfeel/dottask / getTaskContext

Method getTaskContext

taskinfo.go:91–103  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

89}
90
91func (task *TaskInfo) getTaskContext() *TaskContext {
92 ctx := task.taskService.contextPool.Get().(*TaskContext)
93 ctx.TaskID = task.taskID
94 ctx.TaskData = task.TaskData
95 ctx.Header = make(map[string]interface{})
96 if task.Timeout > 0 {
97 timeoutCtx, cancel := context.WithTimeout(context.Background(), time.Second*time.Duration(task.Timeout))
98 ctx.TimeoutContext = timeoutCtx
99 ctx.TimeoutCancel = cancel
100 ctx.doneChan = make(chan struct{})
101 }
102 return ctx
103}
104
105func (task *TaskInfo) putTaskContext(ctx *TaskContext) {
106 ctx.reset()

Callers 7

RunOnceMethod · 0.95
RunOnceMethod · 0.80
doLoopTaskFunction · 0.80
RunOnceMethod · 0.80
startQueueTaskFunction · 0.80
RunOnceMethod · 0.80
doCronTaskFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected