MCPcopy Index your code
hub / github.com/aptly-dev/aptly / runTaskInBackground

Function runTaskInBackground

api/api.go:164–175  ·  view source on GitHub ↗

runs tasks in background. Acquires database connection first.

(name string, resources []string, proc task.Process)

Source from the content-addressed store, hash-verified

162
163// runs tasks in background. Acquires database connection first.
164func runTaskInBackground(name string, resources []string, proc task.Process) (task.Task, *task.ResourceConflictError) {
165 return context.TaskList().RunTaskInBackground(name, resources, func(out aptly.Progress, detail *task.Detail) (*task.ProcessReturnValue, error) {
166 err := acquireDatabaseConnection()
167
168 if err != nil {
169 return nil, err
170 }
171
172 defer func() { _ = releaseDatabaseConnection() }()
173 return proc(out, detail)
174 })
175}
176
177func truthy(value interface{}) bool {
178 if value == nil {

Callers 1

maybeRunTaskInBackgroundFunction · 0.85

Calls 4

RunTaskInBackgroundMethod · 0.80
TaskListMethod · 0.80

Tested by

no test coverage detected