taler-typescript-core

Wallet core logic and WebUIs for various components
Log | Files | Refs | Submodules | README | LICENSE

commit ee2b6de9ec08a00a123da039c4576597ed9a271c
parent 6200fcdd87c1539dea55568bdeb59ab87d57b329
Author: Florian Dold <dold@taler.net>
Date:   Tue, 21 Jul 2026 02:18:22 +0200

util: unregister the cancellation callback after each observed request

onCancelled returns an unregister function that was discarded, so every
completed request left a callback on the caller's long-lived token. Keep the
function and call it in the finally block alongside the cancelator cleanup.

Diffstat:
Mpackages/taler-util/src/observability.ts | 4+++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/packages/taler-util/src/observability.ts b/packages/taler-util/src/observability.ts @@ -56,8 +56,9 @@ export class ObservableHttpClientLibrary implements HttpRequestLibrary { seqId = seqId + 1; const cancelator = CancellationToken.create(); + let unregisterCancel: (() => void) | undefined = undefined; if (opt?.cancellationToken) { - opt.cancellationToken.onCancelled(cancelator.cancel); + unregisterCancel = opt.cancellationToken.onCancelled(cancelator.cancel); } this.cancelatorById.set(id, cancelator); @@ -100,6 +101,7 @@ export class ObservableHttpClientLibrary implements HttpRequestLibrary { throw e; } finally { this.cancelatorById.delete(id); + unregisterCancel?.(); } } }