Skip to content

Commit

Permalink
fix: uptime rollup, use hourly interval instead of two hours
Browse files Browse the repository at this point in the history
  • Loading branch information
mistakia committed Apr 22, 2024
1 parent 10dcf09 commit 40eb758
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions scripts/import-uptime.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,12 @@ const importUptime = async () => {

// process each account
for (const [account, values] of Object.entries(grouped)) {
// rollup into groups of every two hours
// rollup into groups of every hour
const rollup = {}
for (const d of values) {
const diff = dayjs.unix(d.timestamp).diff(now, 'hour')
const hour = Math.abs(diff)
const interval = hour && hour % 2 === 0 ? hour - 1 : hour
const interval = hour
if (!rollup[interval]) rollup[interval] = [d]
else rollup[interval].push(d)
}
Expand Down

0 comments on commit 40eb758

Please sign in to comment.