finalizeAutoRun records a terminal auto-run status ('completed' or 'dead') and clears the supervisor pid. Best-effort: errors are returned for the caller to log, but the run is over regardless.
(db *sql.DB, slug, status string)
| 177 | pid, now, logPath, now, slug, |
| 178 | ) |
| 179 | return err |
| 180 | } |
| 181 | |
| 182 | // finalizeAutoRun records a terminal auto-run status ('completed' or |
| 183 | // 'dead') and clears the supervisor pid. Best-effort: errors are returned |
| 184 | // for the caller to log, but the run is over regardless. |
| 185 | func finalizeAutoRun(db *sql.DB, slug, status string) error { |
| 186 | now := flowdb.NowISO() |
| 187 | _, err := db.Exec( |
| 188 | `UPDATE tasks SET auto_run_status=?, auto_run_finished=?, auto_run_pid=NULL, updated_at=? WHERE slug=?`, |
| 189 | status, now, now, slug, |