signal-desktop/ts/jobs/initializeAllJobQueues.ts

47 lines
1.5 KiB
TypeScript
Raw Normal View History

// Copyright 2021-2022 Signal Messenger, LLC
2021-04-29 23:02:27 +00:00
// SPDX-License-Identifier: AGPL-3.0-only
import type { WebAPIType } from '../textsecure/WebAPI';
2022-02-16 18:36:21 +00:00
import { conversationJobQueue } from './conversationJobQueue';
import { deliveryReceiptsJobQueue } from './deliveryReceiptsJobQueue';
import { readReceiptsJobQueue } from './readReceiptsJobQueue';
import { readSyncJobQueue } from './readSyncJobQueue';
2021-04-29 23:02:27 +00:00
import { removeStorageKeyJobQueue } from './removeStorageKeyJobQueue';
import { reportSpamJobQueue } from './reportSpamJobQueue';
import { singleProtoJobQueue } from './singleProtoJobQueue';
import { viewOnceOpenJobQueue } from './viewOnceOpenJobQueue';
import { viewSyncJobQueue } from './viewSyncJobQueue';
import { viewedReceiptsJobQueue } from './viewedReceiptsJobQueue';
2021-04-29 23:02:27 +00:00
/**
* 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
2022-02-16 18:36:21 +00:00
conversationJobQueue.streamJobs();
// Single proto send queue, used for a variety of one-off simple messages
singleProtoJobQueue.streamJobs();
// Syncs to others
deliveryReceiptsJobQueue.streamJobs();
readReceiptsJobQueue.streamJobs();
viewedReceiptsJobQueue.streamJobs();
// Syncs to ourselves
readSyncJobQueue.streamJobs();
viewSyncJobQueue.streamJobs();
viewOnceOpenJobQueue.streamJobs();
// Other queues
2021-04-29 23:02:27 +00:00
removeStorageKeyJobQueue.streamJobs();
reportSpamJobQueue.streamJobs();
2021-04-29 23:02:27 +00:00
}