getProfiles: Better logging; don't let promise propagate
This commit is contained in:
parent
83e0e5d33b
commit
a39e46db5c
7 changed files with 49 additions and 12 deletions
|
@ -4645,7 +4645,11 @@ export class ConversationModel extends window.Backbone
|
|||
|
||||
onChangeProfileKey(): void {
|
||||
if (isDirectConversation(this.attributes)) {
|
||||
void this.getProfiles();
|
||||
drop(
|
||||
this.getProfiles().catch(() => {
|
||||
/* nothing to do here; logging already happened */
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1048,7 +1048,11 @@ export class MessageModel extends window.Backbone.Model<MessageAttributesType> {
|
|||
switch (error.name) {
|
||||
case 'OutgoingIdentityKeyError': {
|
||||
if (conversation) {
|
||||
promises.push(conversation.getProfiles());
|
||||
promises.push(
|
||||
conversation.getProfiles().catch(() => {
|
||||
/* nothing to do here; logging already happened */
|
||||
})
|
||||
);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -142,12 +142,19 @@ export async function routineProfileRefresh({
|
|||
);
|
||||
successCount += 1;
|
||||
} catch (err) {
|
||||
if ('code' in err) {
|
||||
log.warn(
|
||||
`${logId}: refreshed profile for ${conversation.idForLogging()},`,
|
||||
`got error code ${err.code}`
|
||||
);
|
||||
} else {
|
||||
log.error(
|
||||
`${logId}: refreshed profile for ${conversation.idForLogging()}`,
|
||||
Errors.toLogFormat(err)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const refreshQueue = new PQueue({
|
||||
concurrency: 5,
|
||||
|
|
|
@ -1601,7 +1601,13 @@ async function processRemoteRecords(
|
|||
);
|
||||
|
||||
// Intentionally not awaiting
|
||||
needProfileFetch.map(convo => drop(convo.getProfiles()));
|
||||
needProfileFetch.map(convo =>
|
||||
drop(
|
||||
convo.getProfiles().catch(() => {
|
||||
/* nothing to do here; logging already happened */
|
||||
})
|
||||
)
|
||||
);
|
||||
|
||||
// Collect full map of previously and currently unknown records
|
||||
const unknownRecords: Map<string, UnknownRecord> = new Map();
|
||||
|
|
|
@ -1064,7 +1064,11 @@ export async function mergeContactRecord(
|
|||
) {
|
||||
// Local name doesn't match remote name, fetch profile
|
||||
if (localName) {
|
||||
void conversation.getProfiles();
|
||||
drop(
|
||||
conversation.getProfiles().catch(() => {
|
||||
/* nothing to do here; logging already happened */
|
||||
})
|
||||
);
|
||||
details.push('refreshing profile');
|
||||
} else {
|
||||
conversation.set({
|
||||
|
|
|
@ -11,6 +11,8 @@ export async function toggleVerification(id: string): Promise<void> {
|
|||
export async function reloadProfiles(id: string): Promise<void> {
|
||||
const contact = window.getConversations().get(id);
|
||||
if (contact) {
|
||||
await contact.getProfiles();
|
||||
await contact.getProfiles().catch(() => {
|
||||
/* nothing to do here; logging already happened */
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2741,7 +2741,11 @@ function getProfilesForConversation(conversationId: string): NoopActionType {
|
|||
throw new Error('getProfilesForConversation: no conversation found');
|
||||
}
|
||||
|
||||
void conversation.getProfiles();
|
||||
drop(
|
||||
conversation.getProfiles().catch(() => {
|
||||
/* nothing to do here; logging already happened */
|
||||
})
|
||||
);
|
||||
|
||||
return {
|
||||
type: 'NOOP',
|
||||
|
@ -2765,7 +2769,11 @@ function conversationStoppedByMissingVerification(payload: {
|
|||
}
|
||||
|
||||
// Intentionally not awaiting here
|
||||
void conversation.getProfiles();
|
||||
drop(
|
||||
conversation.getProfiles().catch(() => {
|
||||
/* nothing to do here; logging already happened */
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
return {
|
||||
|
@ -4274,7 +4282,9 @@ function onConversationOpened(
|
|||
conversation.throttledGetProfiles !== undefined,
|
||||
'Conversation model should be initialized'
|
||||
);
|
||||
await conversation.throttledGetProfiles();
|
||||
await conversation.throttledGetProfiles().catch(() => {
|
||||
/* nothing to do here; logging already happened */
|
||||
});
|
||||
}
|
||||
|
||||
drop(conversation.updateVerified());
|
||||
|
|
Loading…
Reference in a new issue