From 6ab16c94f55e0ef23271f3211c298fe2d84ba1fa Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Tue, 18 Jun 2024 19:21:39 +0200 Subject: wallet-core: throttle more long-polling --- packages/taler-wallet-core/src/withdraw.ts | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'packages/taler-wallet-core/src/withdraw.ts') diff --git a/packages/taler-wallet-core/src/withdraw.ts b/packages/taler-wallet-core/src/withdraw.ts index 7ba69d2c1..930aa134b 100644 --- a/packages/taler-wallet-core/src/withdraw.ts +++ b/packages/taler-wallet-core/src/withdraw.ts @@ -824,12 +824,18 @@ async function processWithdrawalGroupDialogProposed( ); url.searchParams.set("old_state", "pending"); - url.searchParams.set("long_poll_ms", "30000"); - const resp = await ctx.wex.http.fetch(url.href, { - method: "GET", - cancellationToken: ctx.wex.cancellationToken, - }); + const res = await ctx.wex.ws.runLongpollQueueing( + url.hostname, + async (timeoutMs) => { + url.searchParams.set("long_poll_ms", `${timeoutMs}`); + + return await ctx.wex.http.fetch(url.href, { + method: "GET", + cancellationToken: ctx.wex.cancellationToken, + }); + }, + ); // If the bank claims that the withdrawal operation is already // pending, but we're still in DialogProposed, some other wallet -- cgit v1.2.3