(tableId: string, jobId: string, error: string)
| 360 | * in-flight run (so a stale worker can't clobber a newer job or a cancel). |
| 361 | */ |
| 362 | export async function markJobFailed(tableId: string, jobId: string, error: string): Promise<void> { |
| 363 | const now = new Date() |
| 364 | await db |
| 365 | .update(tableJobs) |
| 366 | .set({ status: 'failed', error: error.slice(0, 2000), completedAt: now, updatedAt: now }) |
| 367 | .where(ownsActiveJob(tableId, jobId)) |
| 368 | } |
| 369 | |
| 370 | /** |
| 371 | * Marks an in-flight job canceled (user-initiated). No-op unless it's still running. The |
no test coverage detected