feat/fix: proxy.js — growing migrate flow + deltacast cleanup
This commit is contained in:
parent
1f342826bd
commit
9ae619357b
1 changed files with 14 additions and 10 deletions
|
|
@ -78,21 +78,25 @@ export const proxyWorker = async (job) => {
|
||||||
const outputPath = join(tmpDir, `proxy-output-${job.id}.mp4`);
|
const outputPath = join(tmpDir, `proxy-output-${job.id}.mp4`);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
// Look up the asset row early — check status before doing any work,
|
||||||
|
// and read media_type for routing decisions below.
|
||||||
|
const assetRow = await query(
|
||||||
|
'SELECT status, media_type FROM assets WHERE id = $1',
|
||||||
|
[assetId]
|
||||||
|
);
|
||||||
|
const asset = assetRow.rows[0];
|
||||||
|
const dbMediaType = asset?.media_type || null;
|
||||||
|
|
||||||
|
if (asset?.status === 'pending_migration') {
|
||||||
|
console.log(`[proxy] asset ${assetId} is pending_migration, skipping`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Download original from S3
|
// Download original from S3
|
||||||
await job.updateProgress(10);
|
await job.updateProgress(10);
|
||||||
console.log(`[proxy] Downloading ${inputKey} for asset ${assetId}`);
|
console.log(`[proxy] Downloading ${inputKey} for asset ${assetId}`);
|
||||||
await downloadFromS3(S3_BUCKET, inputKey, inputPath);
|
await downloadFromS3(S3_BUCKET, inputKey, inputPath);
|
||||||
|
|
||||||
// Look up the asset row early — we want media_type before deciding how
|
|
||||||
// to process. That lets us route 'image' assets to the poster path even
|
|
||||||
// when ffprobe doesn't return a codec name in IMAGE_CODECS (e.g. future
|
|
||||||
// formats like AVIF / HEIF / JPEG-XL).
|
|
||||||
const assetRow = await query(
|
|
||||||
'SELECT media_type FROM assets WHERE id = $1',
|
|
||||||
[assetId]
|
|
||||||
);
|
|
||||||
const dbMediaType = assetRow.rows[0]?.media_type || null;
|
|
||||||
|
|
||||||
// Reject obviously-empty inputs before handing them to ffmpeg. Aborted
|
// Reject obviously-empty inputs before handing them to ffmpeg. Aborted
|
||||||
// SRT/RTMP recordings end up as 0-byte (or ftyp-only ~1KB) objects in S3
|
// SRT/RTMP recordings end up as 0-byte (or ftyp-only ~1KB) objects in S3
|
||||||
// when the source disconnects before any frame is received; the proxy
|
// when the source disconnects before any frame is received; the proxy
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue