mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Return on proxy error if server is already closed
Signed-off-by: Lauri Nevala <lauri.nevala@gmail.com>
This commit is contained in:
parent
3999e9909a
commit
12f18afe5e
@ -18,6 +18,7 @@ export class LensProxy {
|
||||
protected retryCounters: Map<string, number> = new Map()
|
||||
protected router: Router
|
||||
protected proxyServer: http.Server
|
||||
protected closed = false
|
||||
|
||||
constructor(port: number, clusterManager: ClusterManager) {
|
||||
this.port = port
|
||||
@ -34,6 +35,7 @@ export class LensProxy {
|
||||
public close() {
|
||||
logger.info("Closing proxy server")
|
||||
this.proxyServer.close()
|
||||
this.closed = true
|
||||
}
|
||||
|
||||
protected buildProxyServer() {
|
||||
@ -77,6 +79,9 @@ export class LensProxy {
|
||||
}
|
||||
})
|
||||
proxy.on("error", (error, req, res, target) => {
|
||||
if(this.closed) {
|
||||
return
|
||||
}
|
||||
if (target) {
|
||||
logger.debug("Failed proxy to target: " + JSON.stringify(target))
|
||||
if (req.method === "GET" && (!res.statusCode || res.statusCode >= 500)) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user