mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2026-04-02 08:13:37 +01:00
Simplify TaskWithTimeout
Co-authored-by: trevor-signal <131492920+trevor-signal@users.noreply.github.com>
This commit is contained in:
@@ -19,7 +19,7 @@ import { assertDev, softAssert } from '../util/assert.std.js';
|
||||
import { mapObjectWithSpec } from '../util/mapObjectWithSpec.std.js';
|
||||
import { maybeDeleteAttachmentFile } from '../util/migrations.preload.js';
|
||||
import { cleanDataForIpc } from './cleanDataForIpc.std.js';
|
||||
import createTaskWithTimeout from '../textsecure/TaskWithTimeout.std.js';
|
||||
import { runTaskWithTimeout } from '../textsecure/TaskWithTimeout.std.js';
|
||||
import { isValidUuid, isValidUuidV7 } from '../util/isValidUuid.std.js';
|
||||
import { formatJobForInsert } from '../jobs/formatJobForInsert.std.js';
|
||||
import {
|
||||
@@ -904,10 +904,10 @@ async function invokeWithTimeout(
|
||||
name: string,
|
||||
...args: Array<unknown>
|
||||
): Promise<void> {
|
||||
return createTaskWithTimeout(
|
||||
return runTaskWithTimeout(
|
||||
() => ipc.invoke(name, ...args),
|
||||
`callChannel call to ${name}`
|
||||
)();
|
||||
);
|
||||
}
|
||||
|
||||
export function pauseWriteAccess(): Promise<void> {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
import { ipcRenderer } from 'electron';
|
||||
import { createLogger } from '../logging/log.std.js';
|
||||
import createTaskWithTimeout from '../textsecure/TaskWithTimeout.std.js';
|
||||
import { runTaskWithTimeout } from '../textsecure/TaskWithTimeout.std.js';
|
||||
import { explodePromise } from '../util/explodePromise.std.js';
|
||||
import { missingCaseError } from '../util/missingCaseError.std.js';
|
||||
|
||||
@@ -45,7 +45,7 @@ export async function ipcInvoke<T>(
|
||||
}
|
||||
|
||||
activeJobCount += 1;
|
||||
return createTaskWithTimeout(async () => {
|
||||
return runTaskWithTimeout(async () => {
|
||||
try {
|
||||
const result = await ipcRenderer.invoke(channel, name, ...args);
|
||||
if (!result.ok) {
|
||||
@@ -58,7 +58,7 @@ export async function ipcInvoke<T>(
|
||||
resolveShutdown?.();
|
||||
}
|
||||
}
|
||||
}, `SQL channel call (${access}, ${fnName})`)();
|
||||
}, `SQL channel call (${access}, ${fnName})`);
|
||||
}
|
||||
|
||||
export async function doShutdown(): Promise<void> {
|
||||
|
||||
Reference in New Issue
Block a user