diff --git a/lib/db/snapshotSchedule.ts b/lib/db/snapshotSchedule.ts index 1aa2d06..04bbe6e 100644 --- a/lib/db/snapshotSchedule.ts +++ b/lib/db/snapshotSchedule.ts @@ -207,7 +207,7 @@ export async function adjustSnapshotTime( let initialOffset = 0; if (lastAvailableWindow && lastAvailableWindow.count < allowedCounts) { - initialOffset = lastAvailableWindow.offset; + initialOffset = Math.max(lastAvailableWindow.offset - 2, 0); } let timePerIteration = 0; diff --git a/lib/mq/exec/snapshotTick.ts b/lib/mq/exec/snapshotTick.ts index 2a25265..e2c4ccf 100644 --- a/lib/mq/exec/snapshotTick.ts +++ b/lib/mq/exec/snapshotTick.ts @@ -160,6 +160,7 @@ export const regularSnapshotsWorker = async (_job: Job) => { const startedAt = Date.now(); if (await lockManager.isLocked("dispatchRegularSnapshots")) { logger.log("dispatchRegularSnapshots is already running", "mq"); + client.release(); return; } await lockManager.acquireLock("dispatchRegularSnapshots", 30 * 60); diff --git a/lib/net/bilibili.d.ts b/lib/net/bilibili.d.ts index 6a66ecc..964a87e 100644 --- a/lib/net/bilibili.d.ts +++ b/lib/net/bilibili.d.ts @@ -9,6 +9,24 @@ export type VideoListResponse = BaseResponse; export type VideoDetailsResponse = BaseResponse; export type VideoTagsResponse = BaseResponse; export type VideoInfoResponse = BaseResponse; +export type MediaListInfoResponse = BaseResponse; + +type MediaListInfoData = MediaListInfoItem[]; + + +interface MediaListInfoItem { + bvid: string; + id: number; + cnt_info: { + coin: number; + collect: number; + danmaku: number; + play: number; + reply: number; + share: number; + thumb_up: number; + } +} interface VideoInfoData { bvid: string;