From 8721089e7cd21ee6cdd37c52cdf7c2017042610e Mon Sep 17 00:00:00 2001 From: alikia2x Date: Sun, 9 Mar 2025 22:02:16 +0800 Subject: [PATCH] update: proxies that can be used to snapshot --- lib/mq/scheduler.ts | 6 ++++-- lib/net/getVideoDetails.ts | 2 +- lib/net/getVideoInfo.ts | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/mq/scheduler.ts b/lib/mq/scheduler.ts index 2b7d7ce..719d9f4 100644 --- a/lib/mq/scheduler.ts +++ b/lib/mq/scheduler.ts @@ -282,6 +282,7 @@ class NetScheduler { return JSON.parse(JSON.parse(rawData.body)) as R; } } catch (e) { + logger.error(e, "net", "alicloudFcRequest"); throw new NetSchedulerError(`Unhandled error: Cannot proxy ${url} to ali-fc.`, "ALICLOUD_PROXY_ERR", e); } } @@ -347,13 +348,14 @@ The order of setTaskLimiter and setProviderLimiter relative to each other is fle but both should come after addProxy and addTask to ensure proper setup and dependencies are met. */ +const regions = ["shanghai", "hangzhou", "qingdao", "beijing", "zhangjiakou", "chengdu", "shenzhen", "hohhot"]; netScheduler.addProxy("native", "native", ""); -for (const region of ["shanghai", "hangzhou", "qingdao", "beijing", "zhangjiakou", "chengdu", "shenzhen", "hohhot"]) { +for (const region of regions) { netScheduler.addProxy(`alicloud-${region}`, "alicloud-fc", region); } netScheduler.addTask("getVideoInfo", "bilibili", ["native"]); netScheduler.addTask("getLatestVideos", "bilibili", ["native"]); -netScheduler.addTask("snapshotMilestoneVideo", "bilibili", "all"); +netScheduler.addTask("snapshotMilestoneVideo", "bilibili", regions.map((region) => `alicloud-${region}`)); netScheduler.addTask("snapshotVideo", "bilibili", [ "alicloud-qingdao", "alicloud-shanghai", diff --git a/lib/net/getVideoDetails.ts b/lib/net/getVideoDetails.ts index 1cd7a01..9e421cf 100644 --- a/lib/net/getVideoDetails.ts +++ b/lib/net/getVideoDetails.ts @@ -7,7 +7,7 @@ export async function getVideoDetails(aid: number): Promise(url, "getVideoInfo"); const errMessage = `Error fetching metadata for ${aid}:`; if (data.code !== 0) { - logger.error(errMessage + data.message, "net", "fn:getVideoInfo"); + logger.error(errMessage + data.code + "-" + data.message, "net", "fn:getVideoInfo"); return null; } return data.data; diff --git a/lib/net/getVideoInfo.ts b/lib/net/getVideoInfo.ts index 6540f05..5ccb8ec 100644 --- a/lib/net/getVideoInfo.ts +++ b/lib/net/getVideoInfo.ts @@ -7,7 +7,7 @@ export async function getVideoInfo(aid: number, task: string): Promise(url, task); const errMessage = `Error fetching metadata for ${aid}:`; if (data.code !== 0) { - logger.error(errMessage + data.message, "net", "fn:getVideoInfo"); + logger.error(errMessage + data.code + "-" + data.message, "net", "fn:getVideoInfo"); return null; } return data.data;