mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-13 13:37:31 -07:00
fix: 🐛 patron timeout
This commit is contained in:
parent
c6821f0619
commit
02825ee694
1 changed files with 7 additions and 0 deletions
|
@ -23,8 +23,15 @@ export default define(meta, paramDef, async (ps) => {
|
|||
if (!ps.forceUpdate && cachedPatrons) {
|
||||
patrons = JSON.parse(cachedPatrons);
|
||||
} else {
|
||||
AbortSignal.timeout ??= function timeout(ms) {
|
||||
const ctrl = new AbortController()
|
||||
setTimeout(() => ctrl.abort(), ms)
|
||||
return ctrl.signal
|
||||
}
|
||||
|
||||
patrons = await fetch(
|
||||
"https://codeberg.org/calckey/calckey/raw/branch/develop/patrons.json",
|
||||
{ signal: AbortSignal.timeout(2000) }
|
||||
)
|
||||
.then((response) => response.json())
|
||||
.catch(() => {
|
||||
|
|
Loading…
Reference in a new issue