fix: handle ALICLOUD_PROXY_ERR error in snapshotVideoWorker

This commit is contained in:
alikia2x (寒寒) 2025-04-24 03:42:25 +08:00
parent a67d896d86
commit 1a86831e90
Signed by: alikia2x
GPG Key ID: 56209E0CCD8420C6
2 changed files with 10 additions and 1 deletions

View File

@ -273,7 +273,7 @@ class NetworkDelegate {
} }
} catch (e) { } catch (e) {
logger.error(e as Error, "net", "fn:alicloudFcRequest"); logger.error(e as Error, "net", "fn:alicloudFcRequest");
throw new NetSchedulerError(`Unhandled error: Cannot proxy ${url} to ali-fc.`, "ALICLOUD_PROXY_ERR", e); throw new NetSchedulerError(`Unhandled error: Cannot proxy ${url} to ali-fc-${region}.`, "ALICLOUD_PROXY_ERR", e);
} }
} }
} }

View File

@ -98,6 +98,15 @@ export const snapshotVideoWorker = async (job: Job): Promise<void> => {
await scheduleSnapshot(client, aid, type, Date.now() + retryInterval); await scheduleSnapshot(client, aid, type, Date.now() + retryInterval);
return; return;
} }
else if (e instanceof NetSchedulerError && e.code === "ALICLOUD_PROXY_ERR") {
logger.warn(
`Failed to proxy request for aid ${job.data.aid}: ${e.message}`,
"mq",
"fn:takeSnapshotForVideoWorker",
);
await setSnapshotStatus(client, id, "failed");
await scheduleSnapshot(client, aid, type, Date.now() + retryInterval);
}
logger.error(e as Error, "mq", "fn:takeSnapshotForVideoWorker"); logger.error(e as Error, "mq", "fn:takeSnapshotForVideoWorker");
await setSnapshotStatus(client, id, "failed"); await setSnapshotStatus(client, id, "failed");
}, async () => { }, async () => {