Introduce new conversationJobQueue

This commit is contained in:
Scott Nonnenberg 2022-02-16 10:36:21 -08:00 committed by GitHub
parent 37d4776472
commit 30783c887c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
40 changed files with 3111 additions and 1742 deletions

View file

@ -1,4 +1,4 @@
// Copyright 2020-2021 Signal Messenger, LLC
// Copyright 2020-2022 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
/* eslint-disable camelcase */
@ -1948,6 +1948,13 @@ async function removeMessages(ids: Array<string>): Promise<void> {
async function getMessageById(id: string): Promise<MessageType | undefined> {
const db = getInstance();
return getMessageByIdSync(db, id);
}
export function getMessageByIdSync(
db: Database,
id: string
): MessageType | undefined {
const row = db
.prepare<Query>('SELECT json FROM messages WHERE id = $id;')
.get({
@ -4549,7 +4556,13 @@ async function removeKnownDraftAttachments(
async function getJobsInQueue(queueType: string): Promise<Array<StoredJob>> {
const db = getInstance();
return getJobsInQueueSync(db, queueType);
}
export function getJobsInQueueSync(
db: Database,
queueType: string
): Array<StoredJob> {
return db
.prepare<Query>(
`
@ -4568,7 +4581,7 @@ async function getJobsInQueue(queueType: string): Promise<Array<StoredJob>> {
}));
}
function insertJobSync(db: Database, job: Readonly<StoredJob>): void {
export function insertJobSync(db: Database, job: Readonly<StoredJob>): void {
db.prepare<Query>(
`
INSERT INTO jobs