Skip to content
This repository was archived by the owner on Jun 30, 2025. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions lib/zinnia.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ export const install = () => installBinaryModule({
]
})

let lastCrashReportedAt = 0
let lastErrorReportedAt = 0
const maybeReportErrorToSentry = (/** @type {unknown} */ err) => {
const now = Date.now()
if (now - lastCrashReportedAt < 4 /* HOURS */ * 3600_000) return
lastCrashReportedAt = now
if (now - lastErrorReportedAt < 4 /* HOURS */ * 3600_000) return
lastErrorReportedAt = now

/** @type {Parameters<Sentry.captureException>[1]} */
const hint = { extra: {} }
Expand Down Expand Up @@ -90,7 +90,9 @@ const updateAllSourceFiles = async ({
retries: 10,
onFailedAttempt: err => {
console.error(err)
console.error(`Failed to download ${module} source. Retrying...`)
const msg = `Failed to download ${module} source. Retrying...`
console.error(msg)
maybeReportErrorToSentry(new Error(msg, { cause: err }))
if (String(err).includes('You are being rate limited')) {
const delaySeconds = 30 + (Math.random() * 60)
// Don't DDOS the w3name services
Expand Down