9a9f9495f1
Co-authored-by: Fedor Indutny <79877362+indutny-signal@users.noreply.github.com>
59 lines
1.9 KiB
TypeScript
59 lines
1.9 KiB
TypeScript
// Copyright 2021 Signal Messenger, LLC
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
import type { WebAPIType } from '../textsecure/WebAPI';
|
|
import { drop } from '../util/drop';
|
|
import { callLinksDeleteJobQueue } from './callLinksDeleteJobQueue';
|
|
|
|
import { conversationJobQueue } from './conversationJobQueue';
|
|
import { groupAvatarJobQueue } from './groupAvatarJobQueue';
|
|
import { readSyncJobQueue } from './readSyncJobQueue';
|
|
import { removeStorageKeyJobQueue } from './removeStorageKeyJobQueue';
|
|
import { reportSpamJobQueue } from './reportSpamJobQueue';
|
|
import { singleProtoJobQueue } from './singleProtoJobQueue';
|
|
import { viewOnceOpenJobQueue } from './viewOnceOpenJobQueue';
|
|
import { viewSyncJobQueue } from './viewSyncJobQueue';
|
|
|
|
/**
|
|
* Start all of the job queues. Should be called when the database is ready.
|
|
*/
|
|
export function initializeAllJobQueues({
|
|
server,
|
|
}: {
|
|
server: WebAPIType;
|
|
}): void {
|
|
reportSpamJobQueue.initialize({ server });
|
|
|
|
// General conversation send queue
|
|
drop(conversationJobQueue.streamJobs());
|
|
|
|
// Group avatar download after backup import
|
|
drop(groupAvatarJobQueue.streamJobs());
|
|
|
|
// Single proto send queue, used for a variety of one-off simple messages
|
|
drop(singleProtoJobQueue.streamJobs());
|
|
|
|
// Syncs to ourselves
|
|
drop(readSyncJobQueue.streamJobs());
|
|
drop(viewSyncJobQueue.streamJobs());
|
|
drop(viewOnceOpenJobQueue.streamJobs());
|
|
|
|
// Other queues
|
|
drop(removeStorageKeyJobQueue.streamJobs());
|
|
drop(reportSpamJobQueue.streamJobs());
|
|
drop(callLinksDeleteJobQueue.streamJobs());
|
|
}
|
|
|
|
export async function shutdownAllJobQueues(): Promise<void> {
|
|
await Promise.allSettled([
|
|
conversationJobQueue.shutdown(),
|
|
groupAvatarJobQueue.shutdown(),
|
|
singleProtoJobQueue.shutdown(),
|
|
readSyncJobQueue.shutdown(),
|
|
viewSyncJobQueue.shutdown(),
|
|
viewOnceOpenJobQueue.shutdown(),
|
|
removeStorageKeyJobQueue.shutdown(),
|
|
reportSpamJobQueue.shutdown(),
|
|
callLinksDeleteJobQueue.shutdown(),
|
|
]);
|
|
}
|