fix(core): support FLOOD_PREMIUM_WAIT_
This commit is contained in:
parent
4a7479561b
commit
0c615869d2
1 changed files with 6 additions and 1 deletions
|
@ -90,6 +90,7 @@ export function floodWaiter(options: FloodWaiterOptions): RpcCallMiddleware {
|
||||||
err.startsWith('FLOOD_WAIT_')
|
err.startsWith('FLOOD_WAIT_')
|
||||||
|| err.startsWith('SLOWMODE_WAIT_')
|
|| err.startsWith('SLOWMODE_WAIT_')
|
||||||
|| err.startsWith('FLOOD_TEST_PHONE_WAIT_')
|
|| err.startsWith('FLOOD_TEST_PHONE_WAIT_')
|
||||||
|
|| err.startsWith('FLOOD_PREMIUM_WAIT_')
|
||||||
) {
|
) {
|
||||||
let seconds = Number(err.slice(err.lastIndexOf('_') + 1))
|
let seconds = Number(err.slice(err.lastIndexOf('_') + 1))
|
||||||
|
|
||||||
|
@ -113,7 +114,11 @@ export function floodWaiter(options: FloodWaiterOptions): RpcCallMiddleware {
|
||||||
const ms = seconds * 1000
|
const ms = seconds * 1000
|
||||||
|
|
||||||
if (ms <= floodSleepThreshold) {
|
if (ms <= floodSleepThreshold) {
|
||||||
|
if (ctx.request._ !== 'upload.getFile') {
|
||||||
|
// upload.getFile often results in flood waits, so we don't want to spam the log
|
||||||
ctx.manager._log.warn('%s resulted in a flood wait, will retry in %d seconds', method, seconds)
|
ctx.manager._log.warn('%s resulted in a flood wait, will retry in %d seconds', method, seconds)
|
||||||
|
}
|
||||||
|
|
||||||
await sleepWithAbort(
|
await sleepWithAbort(
|
||||||
ms,
|
ms,
|
||||||
combineAbortSignals(ctx.manager.params.stopSignal, ctx.params?.abortSignal),
|
combineAbortSignals(ctx.manager.params.stopSignal, ctx.params?.abortSignal),
|
||||||
|
|
Loading…
Reference in a new issue