Increase backstop queue timeouts across the app

This commit is contained in:
Scott Nonnenberg 2022-06-27 09:46:43 -07:00 committed by GitHub
parent c28313bd0c
commit 4568527232
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 47 additions and 23 deletions

View File

@ -13,8 +13,9 @@ import type { Props as DropZoneProps } from '../elements/DropZone';
import { DropZone } from '../elements/DropZone';
import { processStickerImage } from '../util/preload';
import { useI18n } from '../util/i18n';
import { MINUTE } from '../../ts/util/durations';
const queue = new PQueue({ concurrency: 3, timeout: 1000 * 60 * 2 });
const queue = new PQueue({ concurrency: 3, timeout: MINUTE * 30 });
type SmartStickerFrameProps = Omit<StickerFrameProps, 'id'> & { id: string };

View File

@ -22,7 +22,7 @@ import { QualifiedAddress } from './types/QualifiedAddress';
import * as log from './logging/log';
import { sleep } from './util/sleep';
import { isNotNil } from './util/isNotNil';
import { SECOND } from './util/durations';
import { MINUTE, SECOND } from './util/durations';
const MAX_MESSAGE_BODY_LENGTH = 64 * 1024;
@ -863,7 +863,7 @@ export class ConversationController {
}
const queue = new PQueue({
concurrency: 3,
timeout: 1000 * 60 * 2,
timeout: MINUTE * 30,
throwOnTimeout: true,
});
queue.addAll(

View File

@ -53,6 +53,7 @@ import * as log from './logging/log';
import { singleProtoJobQueue } from './jobs/singleProtoJobQueue';
import * as Errors from './types/errors';
import MessageSender from './textsecure/SendMessage';
import { MINUTE } from './util/durations';
const TIMESTAMP_THRESHOLD = 5 * 1000; // 5 seconds
@ -533,7 +534,7 @@ export class SignalProtocolStore extends EventsMixin {
private _createSenderKeyQueue(): PQueue {
return new PQueue({
concurrency: 1,
timeout: 1000 * 60 * 2,
timeout: MINUTE * 30,
throwOnTimeout: true,
});
}
@ -702,7 +703,7 @@ export class SignalProtocolStore extends EventsMixin {
private _createSessionQueue(): PQueue {
return new PQueue({
concurrency: 1,
timeout: 1000 * 60 * 2,
timeout: MINUTE * 30,
throwOnTimeout: true,
});
}

View File

@ -428,7 +428,7 @@ export async function startApp(): Promise<void> {
const eventHandlerQueue = new window.PQueue({
concurrency: 1,
timeout: 1000 * 60 * 2,
timeout: durations.MINUTE * 30,
});
const profileKeyResponseQueue = new window.PQueue();
@ -446,7 +446,7 @@ export async function startApp(): Promise<void> {
window.Whisper.deliveryReceiptQueue = new window.PQueue({
concurrency: 1,
timeout: 1000 * 60 * 2,
timeout: durations.MINUTE * 30,
});
window.Whisper.deliveryReceiptQueue.pause();
window.Whisper.deliveryReceiptBatcher =

View File

@ -22,6 +22,7 @@ import PQueue from 'p-queue';
import is from '@sindresorhus/is';
import { getOwn } from '../../util/getOwn';
import * as log from '../../logging/log';
import { MINUTE } from '../../util/durations';
export const skinTones = ['1F3FB', '1F3FC', '1F3FD', '1F3FE', '1F3FF'];
@ -102,7 +103,7 @@ const makeImagePath = (src: string) => {
const imageQueue = new PQueue({
concurrency: 10,
timeout: 1000 * 60 * 2,
timeout: MINUTE * 30,
throwOnTimeout: true,
});
const images = new Set();

View File

@ -44,9 +44,23 @@ export async function doesDatabaseExist(): Promise<boolean> {
});
}
export function removeDatabase(): void {
window.SignalContext.log.info(
`Deleting IndexedDB database '${LEGACY_DATABASE_ID}'`
);
window.indexedDB.deleteDatabase(LEGACY_DATABASE_ID);
export function removeDatabase(): Promise<void> {
return new Promise<void>((resolve, reject) => {
window.SignalContext.log.info(
`removeDatabase: Deleting IndexedDB database '${LEGACY_DATABASE_ID}'`
);
const request = window.indexedDB.deleteDatabase(LEGACY_DATABASE_ID);
request.onerror = () => {
window.SignalContext.log.error(
'removeDatabase: Error deleting database.'
);
reject(new Error('Error deleting database'));
};
request.onsuccess = () => {
window.SignalContext.log.info(
'removeDatabase: Database deleted successfully'
);
resolve();
};
});
}

View File

@ -1384,7 +1384,7 @@ export class ConversationModel extends window.Backbone
if (!this.newMessageQueue) {
this.newMessageQueue = new window.PQueue({
concurrency: 1,
timeout: 1000 * 60 * 2,
timeout: durations.MINUTE * 30,
});
}

View File

@ -13,6 +13,7 @@ import { isOlderThan } from './util/timestamp';
import type { ConversationModel } from './models/conversations';
import type { StorageInterface } from './types/Storage.d';
import { getProfile } from './util/getProfile';
import { MINUTE } from './util/durations';
const STORAGE_KEY = 'lastAttemptedToRefreshProfilesAt';
const MAX_AGE_TO_BE_CONSIDERED_ACTIVE = 30 * 24 * 60 * 60 * 1000;
@ -77,7 +78,7 @@ export async function routineProfileRefresh({
const refreshQueue = new PQueue({
concurrency: 5,
timeout: 1000 * 60 * 2,
timeout: MINUTE * 30,
throwOnTimeout: true,
});
for (const conversation of conversationsToRefresh) {

View File

@ -89,6 +89,7 @@ import type {
} from './Interface';
import Server from './Server';
import { isCorruptionError } from './errors';
import { MINUTE } from '../util/durations';
// We listen to a lot of events on ipc, often on the same channel. This prevents
// any warnings that might be sent to the console in that case.
@ -1407,7 +1408,7 @@ async function removeAllMessagesInConversation(
log.info(`removeAllMessagesInConversation/${logId}: Cleanup...`);
// Note: It's very important that these models are fully hydrated because
// we need to delete all associated on-disk files along with the database delete.
const queue = new window.PQueue({ concurrency: 3, timeout: 1000 * 60 * 2 });
const queue = new window.PQueue({ concurrency: 3, timeout: MINUTE * 30 });
queue.addAll(
messages.map(
(message: MessageType) => async () => cleanupMessage(message)

View File

@ -36,7 +36,7 @@ export default function createTaskWithTimeout<T, Args extends Array<unknown>>(
id: string,
options: { timeout?: number } = {}
): (...args: Args) => Promise<T> {
const timeout = options.timeout || 2 * durations.MINUTE;
const timeout = options.timeout || 30 * durations.MINUTE;
const timeoutError = new Error(`${id || ''} task did not complete in time.`);

View File

@ -2292,7 +2292,7 @@ export function initialize({
// Upload stickers
const queue = new PQueue({
concurrency: 3,
timeout: 1000 * 60 * 2,
timeout: durations.MINUTE * 30,
throwOnTimeout: true,
});
await Promise.all(

View File

@ -25,6 +25,7 @@ import Data from '../sql/Client';
import { SignalService as Proto } from '../protobuf';
import * as log from '../logging/log';
import type { StickersStateType } from '../state/ducks/stickers';
import { MINUTE } from '../util/durations';
export type StickerType = {
packId: string;
@ -101,7 +102,7 @@ const VALID_PACK_ID_REGEXP = /^[0-9a-f]{32}$/i;
let initialState: StickersStateType | undefined;
let packsToDownload: DownloadMap | undefined;
const downloadQueue = new Queue({ concurrency: 1, timeout: 1000 * 60 * 2 });
const downloadQueue = new Queue({ concurrency: 1, timeout: MINUTE * 30 });
export async function load(): Promise<void> {
const [packs, recentStickers] = await Promise.all([

View File

@ -7,6 +7,7 @@ import { sleep } from './sleep';
import * as log from '../logging/log';
import * as Errors from '../types/errors';
import { clearTimeoutIfNecessary } from './clearTimeoutIfNecessary';
import { MINUTE } from './durations';
declare global {
// We want to extend `window`'s properties, so we need an interface.
@ -56,7 +57,7 @@ export function createBatcher<ItemType>(
let items: Array<ItemType> = [];
const queue = new PQueue({
concurrency: 1,
timeout: 1000 * 60 * 2,
timeout: MINUTE * 30,
throwOnTimeout: true,
});

View File

@ -2,11 +2,12 @@
// SPDX-License-Identifier: AGPL-3.0-only
import PQueue from 'p-queue';
import { MINUTE } from './durations';
import { Sound } from './Sound';
const ringtoneEventQueue = new PQueue({
concurrency: 1,
timeout: 1000 * 60 * 2,
timeout: MINUTE * 30,
throwOnTimeout: true,
});

View File

@ -59,6 +59,7 @@ import { SignalService as Proto } from '../protobuf';
import { strictAssert } from './assert';
import * as log from '../logging/log';
import { GLOBAL_ZONE } from '../SignalProtocolStore';
import { MINUTE } from './durations';
const ERROR_EXPIRED_OR_MISSING_DEVICES = 409;
const ERROR_STALE_DEVICES = 410;
@ -814,7 +815,7 @@ export async function _waitForAll<T>({
}): Promise<Array<T>> {
const queue = new PQueue({
concurrency: maxConcurrency,
timeout: 2 * 60 * 1000,
timeout: MINUTE * 30,
throwOnTimeout: true,
});
return queue.addAll(tasks);

View File

@ -7,6 +7,7 @@ import { sleep } from './sleep';
import * as log from '../logging/log';
import * as Errors from '../types/errors';
import { clearTimeoutIfNecessary } from './clearTimeoutIfNecessary';
import { MINUTE } from './durations';
declare global {
// We want to extend `window`'s properties, so we need an interface.
@ -80,7 +81,7 @@ export function createWaitBatcher<ItemType>(
let items: Array<ItemHolderType<ItemType>> = [];
const queue = new PQueue({
concurrency: 1,
timeout: 1000 * 60 * 2,
timeout: MINUTE * 30,
throwOnTimeout: true,
});