From c839e6fdfcdd724fa622d68fea2d362a555ce4fd Mon Sep 17 00:00:00 2001 From: Jari Kolehmainen Date: Mon, 21 Dec 2020 22:10:32 +0200 Subject: [PATCH] Fix proxy retry counter cleanup on success (#1825) Signed-off-by: Jari Kolehmainen --- src/main/lens-proxy.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/lens-proxy.ts b/src/main/lens-proxy.ts index 5770429a7e..e4f6ab4a34 100644 --- a/src/main/lens-proxy.ts +++ b/src/main/lens-proxy.ts @@ -120,6 +120,14 @@ export class LensProxy { protected createProxy(): httpProxy { const proxy = httpProxy.createProxyServer(); + proxy.on("proxyRes", (proxyRes, req) => { + const retryCounterId = this.getRequestId(req); + + if (this.retryCounters.has(retryCounterId)) { + this.retryCounters.delete(retryCounterId); + } + }); + proxy.on("error", (error, req, res, target) => { if (this.closed) { return;