Refactor contact sync processing
This commit is contained in:
parent
76e73f63dc
commit
7ce4beb270
10 changed files with 229 additions and 156 deletions
|
@ -4,6 +4,7 @@
|
|||
import { compact, has, isNumber, throttle, debounce } from 'lodash';
|
||||
import { batch as batchDispatch } from 'react-redux';
|
||||
import { v4 as generateGuid } from 'uuid';
|
||||
import PQueue from 'p-queue';
|
||||
|
||||
import type {
|
||||
ConversationAttributesType,
|
||||
|
@ -191,9 +192,9 @@ export class ConversationModel extends window.Backbone
|
|||
|
||||
inProgressFetch?: Promise<unknown>;
|
||||
|
||||
newMessageQueue?: typeof window.PQueueType;
|
||||
newMessageQueue?: PQueue;
|
||||
|
||||
jobQueue?: typeof window.PQueueType;
|
||||
jobQueue?: PQueue;
|
||||
|
||||
storeName?: string | null;
|
||||
|
||||
|
@ -1313,7 +1314,7 @@ export class ConversationModel extends window.Backbone
|
|||
|
||||
private async beforeAddSingleMessage(): Promise<void> {
|
||||
if (!this.newMessageQueue) {
|
||||
this.newMessageQueue = new window.PQueue({
|
||||
this.newMessageQueue = new PQueue({
|
||||
concurrency: 1,
|
||||
timeout: durations.MINUTE * 30,
|
||||
});
|
||||
|
@ -3427,7 +3428,7 @@ export class ConversationModel extends window.Backbone
|
|||
name: string,
|
||||
callback: (abortSignal: AbortSignal) => Promise<T>
|
||||
): Promise<T> {
|
||||
this.jobQueue = this.jobQueue || new window.PQueue({ concurrency: 1 });
|
||||
this.jobQueue = this.jobQueue || new PQueue({ concurrency: 1 });
|
||||
|
||||
const taskWithTimeout = createTaskWithTimeout(
|
||||
callback,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue