mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-04-20 19:38:39 +00:00
queue sync calls
This commit is contained in:
14
api/api.go
14
api/api.go
@@ -164,9 +164,17 @@ func maybeRunTaskInBackground(c *gin.Context, name string, resources []string, p
|
||||
c.JSON(202, task)
|
||||
} else {
|
||||
log.Debug().Msg("Executing task synchronously")
|
||||
out := context.Progress()
|
||||
detail := task.Detail{}
|
||||
retValue, err := proc(out, &detail)
|
||||
task, conflictErr := runTaskInBackground(name, resources, proc)
|
||||
if conflictErr != nil {
|
||||
AbortWithJSONError(c, 409, conflictErr)
|
||||
return
|
||||
}
|
||||
|
||||
// wait for task to finish
|
||||
context.TaskList().WaitForTaskByID(task.ID)
|
||||
|
||||
retValue, _ := context.TaskList().GetTaskReturnValueByID(task.ID)
|
||||
err, _ := context.TaskList().GetTaskErrorByID(task.ID)
|
||||
if err != nil {
|
||||
AbortWithJSONError(c, retValue.Code, err)
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user