(upload: {
phase: string;
updatedAt: Date;
processingProgress: number;
})
| 20 | const STALE_THUMBNAIL_MS = 5 * MINUTE; |
| 21 | |
| 22 | const shouldForceRetryProcessing = (upload: { |
| 23 | phase: string; |
| 24 | updatedAt: Date; |
| 25 | processingProgress: number; |
| 26 | }) => { |
| 27 | const ageMs = Date.now() - upload.updatedAt.getTime(); |
| 28 | |
| 29 | if (upload.phase === "processing") { |
| 30 | if (upload.processingProgress === 0 && ageMs > STALE_PROCESSING_START_MS) { |
| 31 | return true; |
| 32 | } |
| 33 | |
| 34 | return ageMs > STALE_PROCESSING_PROGRESS_MS; |
| 35 | } |
| 36 | |
| 37 | if (upload.phase === "generating_thumbnail") { |
| 38 | return ageMs > STALE_THUMBNAIL_MS; |
| 39 | } |
| 40 | |
| 41 | return false; |
| 42 | }; |
| 43 | |
| 44 | export async function retryVideoProcessing({ |
| 45 | videoId, |
no outgoing calls
no test coverage detected