2022-01-14 21:34:52 +00:00
|
|
|
// Copyright 2021-2022 Signal Messenger, LLC
|
2021-04-29 23:02:27 +00:00
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
2021-07-23 17:23:50 +00:00
|
|
|
import type { WebAPIType } from '../textsecure/WebAPI';
|
2022-12-21 18:41:48 +00:00
|
|
|
import { drop } from '../util/drop';
|
2021-07-23 17:23:50 +00:00
|
|
|
|
2022-02-16 18:36:21 +00:00
|
|
|
import { conversationJobQueue } from './conversationJobQueue';
|
2021-12-07 22:41:40 +00:00
|
|
|
import { deliveryReceiptsJobQueue } from './deliveryReceiptsJobQueue';
|
|
|
|
import { readReceiptsJobQueue } from './readReceiptsJobQueue';
|
2021-07-23 22:02:36 +00:00
|
|
|
import { readSyncJobQueue } from './readSyncJobQueue';
|
2021-04-29 23:02:27 +00:00
|
|
|
import { removeStorageKeyJobQueue } from './removeStorageKeyJobQueue';
|
2021-05-27 20:17:05 +00:00
|
|
|
import { reportSpamJobQueue } from './reportSpamJobQueue';
|
2022-01-14 21:34:52 +00:00
|
|
|
import { singleProtoJobQueue } from './singleProtoJobQueue';
|
2022-02-08 17:30:42 +00:00
|
|
|
import { viewOnceOpenJobQueue } from './viewOnceOpenJobQueue';
|
2021-08-12 18:15:55 +00:00
|
|
|
import { viewSyncJobQueue } from './viewSyncJobQueue';
|
2021-08-17 15:43:26 +00:00
|
|
|
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.
|
|
|
|
*/
|
2021-07-23 17:23:50 +00:00
|
|
|
export function initializeAllJobQueues({
|
|
|
|
server,
|
|
|
|
}: {
|
|
|
|
server: WebAPIType;
|
|
|
|
}): void {
|
|
|
|
reportSpamJobQueue.initialize({ server });
|
|
|
|
|
2022-02-08 17:30:42 +00:00
|
|
|
// General conversation send queue
|
2022-12-21 18:41:48 +00:00
|
|
|
drop(conversationJobQueue.streamJobs());
|
2022-02-08 17:30:42 +00:00
|
|
|
|
|
|
|
// Single proto send queue, used for a variety of one-off simple messages
|
2022-12-21 18:41:48 +00:00
|
|
|
drop(singleProtoJobQueue.streamJobs());
|
2022-02-08 17:30:42 +00:00
|
|
|
|
|
|
|
// Syncs to others
|
2022-12-21 18:41:48 +00:00
|
|
|
drop(deliveryReceiptsJobQueue.streamJobs());
|
|
|
|
drop(readReceiptsJobQueue.streamJobs());
|
|
|
|
drop(viewedReceiptsJobQueue.streamJobs());
|
2022-02-08 17:30:42 +00:00
|
|
|
|
|
|
|
// Syncs to ourselves
|
2022-12-21 18:41:48 +00:00
|
|
|
drop(readSyncJobQueue.streamJobs());
|
|
|
|
drop(viewSyncJobQueue.streamJobs());
|
|
|
|
drop(viewOnceOpenJobQueue.streamJobs());
|
2022-02-08 17:30:42 +00:00
|
|
|
|
|
|
|
// Other queues
|
2022-12-21 18:41:48 +00:00
|
|
|
drop(removeStorageKeyJobQueue.streamJobs());
|
|
|
|
drop(reportSpamJobQueue.streamJobs());
|
2021-04-29 23:02:27 +00:00
|
|
|
}
|