mirror of
https://activitypub.software/TransFem-org/Sharkey.git
synced 2024-12-29 13:59:26 +01:00
merge: on 429, retry fetchAccount
instead of failing (!817)
View MR for information: https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/817 Approved-by: Hazelnoot <acomputerdog@gmail.com> Approved-by: Marie <github@yuugi.dev>
This commit is contained in:
commit
9dc03858bd
2 changed files with 8 additions and 1 deletions
|
@ -340,7 +340,7 @@ export class ApiCallService implements OnApplicationShutdown {
|
||||||
code: 'RATE_LIMIT_EXCEEDED',
|
code: 'RATE_LIMIT_EXCEEDED',
|
||||||
id: 'd5826d14-3982-4d2e-8011-b9e9f02499ef',
|
id: 'd5826d14-3982-4d2e-8011-b9e9f02499ef',
|
||||||
httpStatusCode: 429,
|
httpStatusCode: 429,
|
||||||
});
|
}, info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -147,6 +147,13 @@ function fetchAccount(token: string, id?: string, forceShowDialog?: boolean): Pr
|
||||||
text: i18n.ts.tokenRevokedDescription,
|
text: i18n.ts.tokenRevokedDescription,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
} else if (res.error.id === 'd5826d14-3982-4d2e-8011-b9e9f02499ef') {
|
||||||
|
// rate limited
|
||||||
|
const timeToWait = res.error.info?.resetMs ?? 1000;
|
||||||
|
window.setTimeout(timeToWait, () => {
|
||||||
|
fetchAccount(token, id, forceShowDialog).then(done, fail);
|
||||||
|
});
|
||||||
|
return;
|
||||||
} else {
|
} else {
|
||||||
await alert({
|
await alert({
|
||||||
type: 'error',
|
type: 'error',
|
||||||
|
|
Loading…
Reference in a new issue