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:
parent
ff892a1ad5
commit
fb3b998cfd
1 changed files with 6 additions and 1 deletions
|
|
@ -64,7 +64,12 @@ export const thumbnailWorker = async (job) => {
|
||||||
return { assetId, outputKey };
|
return { assetId, outputKey };
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(`[thumbnail] Error processing asset ${assetId}:`, 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;
|
throw error;
|
||||||
} finally {
|
} finally {
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue