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:
parent
4851a69b91
commit
871a0f1f65
@ -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;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user