1
0

fix: regular snapshot interval will set to 24 hrs if recent two snapshots are too close, this may cause problems

This commit is contained in:
alikia2x (寒寒) 2025-11-19 02:39:53 +08:00
parent 4851a69b91
commit 871a0f1f65
WARNING! Although there is a key with this ID in the database it does not verify this commit! This commit is SUSPICIOUS.
GPG Key ID: 56209E0CCD8420C6

View File

@ -11,7 +11,6 @@ export const getRegularSnapshotInterval = async (sql: Psql, aid: number) => {
if (!oldSnapshot || !latestSnapshot) return 0;
if (oldSnapshot.created_at === latestSnapshot.created_at) return 0;
const hoursDiff = (latestSnapshot.created_at - oldSnapshot.created_at) / HOUR;
if (hoursDiff < 8) return 24;
const viewsDiff = latestSnapshot.views - oldSnapshot.views;
if (viewsDiff === 0) return 72;
const speedPerDay = (viewsDiff / (hoursDiff + 0.001)) * 24;