Simplify TaskWithTimeout

Co-authored-by: trevor-signal <131492920+trevor-signal@users.noreply.github.com>
This commit is contained in:
Fedor Indutny
2026-03-24 09:08:36 -07:00
committed by GitHub
parent c050a0c8c2
commit b8cca2c49c
12 changed files with 164 additions and 212 deletions

View File

@@ -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> {

View File

@@ -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> {