fix(worker/thumbnail): mark asset ready even when thumbnail extraction fails

If the thumbnail job throws (network blip, ffmpeg error, short clip), the
asset was left stuck in status='processing' indefinitely. Since the proxy
already exists and the asset is playable, set status='ready' in the catch
block before re-throwing so BullMQ can still record the failure.
This commit is contained in:
Zac Gaetano 2026-05-18 23:51:04 -04:00
parent ff892a1ad5
commit fb3b998cfd

View file

@ -64,7 +64,12 @@ export const thumbnailWorker = async (job) => {
return { assetId, outputKey };
} catch (error) {
console.error(`[thumbnail] Error processing asset ${assetId}:`, error);
// Don't set status=error for thumbnail failure — asset is still usable without it
// Thumbnail failed but the asset is still usable via proxy — mark it ready
// so it doesn't stay in 'processing' state forever.
await query(
`UPDATE assets SET status = 'ready', updated_at = NOW() WHERE id = $1`,
[assetId]
).catch(e => console.error('[thumbnail] Failed to update asset status:', e));
throw error;
} finally {
await Promise.all([