2023-01-03 19:55:46 +00:00
|
|
|
// Copyright 2021 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';
|
2024-10-09 16:54:24 +00:00
|
|
|
import { CallLinkFinalizeDeleteManager } from './CallLinkFinalizeDeleteManager';
|
2021-07-23 17:23:50 +00:00
|
|
|
|
2024-09-17 05:54:59 +00:00
|
|
|
import { callLinkRefreshJobQueue } from './callLinkRefreshJobQueue';
|
2022-02-16 18:36:21 +00:00
|
|
|
import { conversationJobQueue } from './conversationJobQueue';
|
2024-06-24 18:38:59 +00:00
|
|
|
import { groupAvatarJobQueue } from './groupAvatarJobQueue';
|
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-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
|
|
|
|
2024-06-24 18:38:59 +00:00
|
|
|
// Group avatar download after backup import
|
|
|
|
drop(groupAvatarJobQueue.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 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());
|
2024-09-17 05:54:59 +00:00
|
|
|
drop(callLinkRefreshJobQueue.streamJobs());
|
2024-10-09 16:54:24 +00:00
|
|
|
drop(CallLinkFinalizeDeleteManager.start());
|
2021-04-29 23:02:27 +00:00
|
|
|
}
|
2023-02-24 19:03:17 +00:00
|
|
|
|
|
|
|
export async function shutdownAllJobQueues(): Promise<void> {
|
|
|
|
await Promise.allSettled([
|
2024-09-17 05:54:59 +00:00
|
|
|
callLinkRefreshJobQueue.shutdown(),
|
2023-02-24 19:03:17 +00:00
|
|
|
conversationJobQueue.shutdown(),
|
2024-06-24 18:38:59 +00:00
|
|
|
groupAvatarJobQueue.shutdown(),
|
2023-02-24 19:03:17 +00:00
|
|
|
singleProtoJobQueue.shutdown(),
|
|
|
|
readSyncJobQueue.shutdown(),
|
|
|
|
viewSyncJobQueue.shutdown(),
|
|
|
|
viewOnceOpenJobQueue.shutdown(),
|
|
|
|
removeStorageKeyJobQueue.shutdown(),
|
|
|
|
reportSpamJobQueue.shutdown(),
|
2024-10-09 16:54:24 +00:00
|
|
|
CallLinkFinalizeDeleteManager.stop(),
|
2023-02-24 19:03:17 +00:00
|
|
|
]);
|
|
|
|
}
|