mirror of
https://github.com/pockethost/pockethost.git
synced 2025-11-24 06:25:48 +00:00
catch 429 errors from Discord
This commit is contained in:
parent
9698e795e1
commit
d836b16cc2
@ -141,6 +141,15 @@ 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
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -148,7 +157,7 @@ export const checkHealth = async () => {
|
|||||||
|
|
||||||
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`)
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user