Fix failover on failed sends, and improve logging
This commit is contained in:
parent
5e9bbb42f1
commit
65b6d9c2bc
4 changed files with 19 additions and 4 deletions
|
@ -1772,7 +1772,9 @@ export async function startApp(): Promise<void> {
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
log.error(
|
log.error(
|
||||||
'connect: Error refreshing remote config:',
|
'connect: Error refreshing remote config:',
|
||||||
Errors.toLogFormat(error)
|
isNumber(error.code)
|
||||||
|
? `code: ${error.code}`
|
||||||
|
: Errors.toLogFormat(error)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
import type { ProfileKeyCredentialRequestContext } from '@signalapp/libsignal-client/zkgroup';
|
import type { ProfileKeyCredentialRequestContext } from '@signalapp/libsignal-client/zkgroup';
|
||||||
import PQueue from 'p-queue';
|
import PQueue from 'p-queue';
|
||||||
|
import { isNumber } from 'lodash';
|
||||||
|
|
||||||
import type { ConversationModel } from '../models/conversations';
|
import type { ConversationModel } from '../models/conversations';
|
||||||
import type {
|
import type {
|
||||||
|
@ -496,7 +497,9 @@ async function doGetProfile(c: ConversationModel): Promise<void> {
|
||||||
log.warn(
|
log.warn(
|
||||||
'getProfile failure:',
|
'getProfile failure:',
|
||||||
idForLogging,
|
idForLogging,
|
||||||
Errors.toLogFormat(error)
|
isNumber(error.code)
|
||||||
|
? `code: ${error.code}`
|
||||||
|
: Errors.toLogFormat(error)
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -539,9 +539,12 @@ export default class OutgoingMessage {
|
||||||
},
|
},
|
||||||
async (error: Error) => {
|
async (error: Error) => {
|
||||||
if (
|
if (
|
||||||
error instanceof HTTPError &&
|
error instanceof SendMessageNetworkError &&
|
||||||
(error.code === 401 || error.code === 403)
|
(error.code === 401 || error.code === 403)
|
||||||
) {
|
) {
|
||||||
|
log.warn(
|
||||||
|
`OutgoingMessage.doSendMessage: Failing over to unsealed send for identifier ${identifier}`
|
||||||
|
);
|
||||||
if (this.failoverIdentifiers.indexOf(identifier) === -1) {
|
if (this.failoverIdentifiers.indexOf(identifier) === -1) {
|
||||||
this.failoverIdentifiers.push(identifier);
|
this.failoverIdentifiers.push(identifier);
|
||||||
}
|
}
|
||||||
|
|
|
@ -843,7 +843,14 @@ export function _shouldFailSend(error: unknown, logId: string): boolean {
|
||||||
|
|
||||||
if (error instanceof SendMessageProtoError) {
|
if (error instanceof SendMessageProtoError) {
|
||||||
if (!error.errors || !error.errors.length) {
|
if (!error.errors || !error.errors.length) {
|
||||||
logError('SendMessageProtoError had no errors, failing.');
|
logError('SendMessageProtoError had no errors but was thrown! Failing.');
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (error.successfulIdentifiers && error.successfulIdentifiers.length > 0) {
|
||||||
|
logError(
|
||||||
|
'SendMessageProtoError had successful sends; no further sends needed. Failing.'
|
||||||
|
);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue