catch 429 errors from Discord

This commit is contained in:
Ben Allfree 2024-11-21 20:23:04 +00:00
parent 9698e795e1
commit d836b16cc2

View File

@ -141,6 +141,15 @@ export const checkHealth = async () => {
content,
}),
headers: { 'content-type': 'application/json' },
})
.then((res) => {
if (res.status !== 200) {
throw new Error(`${res.status} ${res.statusText}`)
}
})
.catch((e) => {
console.error({ e })
throw e
}),
),
),
@ -148,7 +157,7 @@ export const checkHealth = async () => {
const openFiles = _exec(`cat /proc/sys/fs/file-nr`)[0]?.trim() || `Unknown`
await send([
const meta = [
`===================`,
`${new Date()}`,
`CPUs: ${cpu.count()}`,
@ -160,7 +169,9 @@ export const checkHealth = async () => {
}GB`,
`Open files: ${openFiles}`,
`Containers: ${containers.length}`,
])
]
console.log(meta.join('\n'))
await send(meta)
const checks: Check[] = [
{
@ -228,4 +239,5 @@ export const checkHealth = async () => {
}
}),
])
dbg(`done`)
}