MCPcopy Index your code
hub / github.com/CovenantSQL/CovenantSQL / New

Method New

cmd/cql-proxy/task/task.go:144–164  ·  view source on GitHub ↗

New pushes new task to scheduling pool.

(tt model.TaskType, developer int64, account int64, args gin.H)

Source from the content-addressed store, hash-verified

142
143// New pushes new task to scheduling pool.
144func (m *Manager) New(tt model.TaskType, developer int64, account int64, args gin.H) (id int64, err error) {
145 t, err := model.NewTask(m.db, tt, developer, account, args)
146 if err != nil {
147 err = errors.Wrapf(err, "new task failed")
148 return
149 }
150
151 id = t.ID
152
153 select {
154 case m.newCh <- t:
155 log.Debugf("created new task: %v", t.LogData())
156 case <-m.ctx.Done():
157 t.Result = gin.H{
158 "error": m.ctx.Err(),
159 }
160 _ = model.UpdateTask(m.db, t)
161 }
162
163 return
164}
165
166// Register register new handle for specified task type to run.
167func (m *Manager) Register(tt model.TaskType, f HandleFunc) {

Callers

nothing calls this directly

Calls 4

LogDataMethod · 0.95
NewTaskFunction · 0.92
DebugfFunction · 0.92
UpdateTaskFunction · 0.92

Tested by

no test coverage detected