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,14 +141,23 @@ export const checkHealth = async () => {
content, content,
}), }),
headers: { 'content-type': 'application/json' }, 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
}),
), ),
), ),
) )
const openFiles = _exec(`cat /proc/sys/fs/file-nr`)[0]?.trim() || `Unknown` const openFiles = _exec(`cat /proc/sys/fs/file-nr`)[0]?.trim() || `Unknown`
await send([ const meta = [
`===================`, `===================`,
`${new Date()}`, `${new Date()}`,
`CPUs: ${cpu.count()}`, `CPUs: ${cpu.count()}`,
@ -160,7 +169,9 @@ export const checkHealth = async () => {
}GB`, }GB`,
`Open files: ${openFiles}`, `Open files: ${openFiles}`,
`Containers: ${containers.length}`, `Containers: ${containers.length}`,
]) ]
console.log(meta.join('\n'))
await send(meta)
const checks: Check[] = [ const checks: Check[] = [
{ {
@ -228,4 +239,5 @@ export const checkHealth = async () => {
} }
}), }),
]) ])
dbg(`done`)
} }