Add preliminary message backup harness
This commit is contained in:
parent
231bf91a22
commit
d85a1d5074
38 changed files with 2997 additions and 121 deletions
|
@ -4,6 +4,7 @@
|
|||
import { debounce, pick, uniq, without } from 'lodash';
|
||||
import PQueue from 'p-queue';
|
||||
import { v4 as generateUuid } from 'uuid';
|
||||
import { batch as batchDispatch } from 'react-redux';
|
||||
|
||||
import type {
|
||||
ConversationModelCollectionType,
|
||||
|
@ -831,7 +832,7 @@ export class ConversationController {
|
|||
// Note: `doCombineConversations` is directly used within this function since both
|
||||
// run on `_combineConversationsQueue` queue and we don't want deadlocks.
|
||||
private async doCheckForConflicts(): Promise<void> {
|
||||
log.info('checkForConflicts: starting...');
|
||||
log.info('ConversationController.checkForConflicts: starting...');
|
||||
const byServiceId = Object.create(null);
|
||||
const byE164 = Object.create(null);
|
||||
const byGroupV2Id = Object.create(null);
|
||||
|
@ -1420,13 +1421,17 @@ export class ConversationController {
|
|||
);
|
||||
await queue.onIdle();
|
||||
|
||||
// Hydrate the final set of conversations
|
||||
this._conversations.add(
|
||||
collection.filter(conversation => !conversation.isTemporary)
|
||||
);
|
||||
|
||||
// It is alright to call it first because the 'add'/'update' events are
|
||||
// triggered after updating the collection.
|
||||
this._initialFetchComplete = true;
|
||||
|
||||
// Hydrate the final set of conversations
|
||||
batchDispatch(() => {
|
||||
this._conversations.add(
|
||||
collection.filter(conversation => !conversation.isTemporary)
|
||||
);
|
||||
});
|
||||
|
||||
await Promise.all(
|
||||
this._conversations.map(async conversation => {
|
||||
try {
|
||||
|
@ -1466,7 +1471,10 @@ export class ConversationController {
|
|||
}
|
||||
})
|
||||
);
|
||||
log.info('ConversationController: done with initial fetch');
|
||||
log.info(
|
||||
'ConversationController: done with initial fetch, ' +
|
||||
`got ${this._conversations.length} conversations`
|
||||
);
|
||||
} catch (error) {
|
||||
log.error(
|
||||
'ConversationController: initial fetch failed',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue