MCPcopy
hub / github.com/CapSoftware/Cap / shouldForceRetryProcessing

Function shouldForceRetryProcessing

apps/web/actions/video/retry-processing.ts:22–42  ·  view source on GitHub ↗
(upload: {
	phase: string;
	updatedAt: Date;
	processingProgress: number;
})

Source from the content-addressed store, hash-verified

20const STALE_THUMBNAIL_MS = 5 * MINUTE;
21
22const 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
44export async function retryVideoProcessing({
45 videoId,

Callers 1

retryVideoProcessingFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected