Stop retrying message send on 400 response

This commit is contained in:
Fedor Indutny 2022-05-23 09:27:40 -07:00 committed by GitHub
parent 3aa958533b
commit 5c72c785a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View File

@ -53,7 +53,7 @@ export async function handleMultipleSendErrors({
retryAfterError = error;
longestRetryAfterTime = retryAfterTime;
}
} else if (errorCode === 508) {
} else if (errorCode === 508 || errorCode === 400) {
serverAskedUsToStop = true;
}
});
@ -67,7 +67,7 @@ export async function handleMultipleSendErrors({
}
if (serverAskedUsToStop) {
log.info('server responded with 508. Giving up on this job');
log.info('server responded with 508 or 400. Giving up on this job');
return;
}

View File

@ -731,6 +731,11 @@ export function _shouldFailSend(error: unknown, logId: string): boolean {
// SendMessageChallengeError
// MessageError
if (isRecord(error) && typeof error.code === 'number') {
if (error.code === 400) {
logError('Invalid request, failing.');
return true;
}
if (error.code === 401) {
logError('Permissions error, failing.');
return true;