runs tasks in background. Acquires database connection first.
(name string, resources []string, proc task.Process)
| 162 | |
| 163 | // runs tasks in background. Acquires database connection first. |
| 164 | func 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 | |
| 177 | func truthy(value interface{}) bool { |
| 178 | if value == nil { |
no test coverage detected