fix: clearInbox request timeout after 10s

pull/3206/head
Audric Ackermann 1 year ago
parent 95f2f42243
commit 6c617de892
No known key found for this signature in database

@ -8,6 +8,7 @@ import {
sogsBatchSend, sogsBatchSend,
} from './sogsV3BatchPoll'; } from './sogsV3BatchPoll';
import { OpenGroupRequestCommonType } from '../../../../data/types'; import { OpenGroupRequestCommonType } from '../../../../data/types';
import { PromiseUtils } from '../../../utils';
type OpenGroupClearInboxResponse = { type OpenGroupClearInboxResponse = {
deleted: number; deleted: number;
@ -31,12 +32,17 @@ export const clearInbox = async (roomInfos: OpenGroupRequestCommonType): Promise
}, },
]; ];
const result = await sogsBatchSend( const abortSignal = new AbortController();
roomInfos.serverUrl,
new Set([roomInfos.roomId]), const result = await PromiseUtils.timeout(
new AbortController().signal, sogsBatchSend(
options, roomInfos.serverUrl,
'batch' new Set([roomInfos.roomId]),
abortSignal.signal,
options,
'batch'
),
10000
); );
if (!result) { if (!result) {

@ -150,7 +150,7 @@ const forceNetworkDeletion = async (): Promise<Array<string> | null> => {
} }
}, },
{ {
retries: 3, retries: 1,
minTimeout: SnodeAPI.TEST_getMinTimeout(), minTimeout: SnodeAPI.TEST_getMinTimeout(),
onFailedAttempt: e => { onFailedAttempt: e => {
window?.log?.warn( window?.log?.warn(

Loading…
Cancel
Save