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 retryCounters: Map<string, number> = new Map()
|
||||||
protected router: Router
|
protected router: Router
|
||||||
protected proxyServer: http.Server
|
protected proxyServer: http.Server
|
||||||
|
protected closed = false
|
||||||
|
|
||||||
constructor(port: number, clusterManager: ClusterManager) {
|
constructor(port: number, clusterManager: ClusterManager) {
|
||||||
this.port = port
|
this.port = port
|
||||||
@ -34,6 +35,7 @@ export class LensProxy {
|
|||||||
public close() {
|
public close() {
|
||||||
logger.info("Closing proxy server")
|
logger.info("Closing proxy server")
|
||||||
this.proxyServer.close()
|
this.proxyServer.close()
|
||||||
|
this.closed = true
|
||||||
}
|
}
|
||||||
|
|
||||||
protected buildProxyServer() {
|
protected buildProxyServer() {
|
||||||
@ -77,6 +79,9 @@ export class LensProxy {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
proxy.on("error", (error, req, res, target) => {
|
proxy.on("error", (error, req, res, target) => {
|
||||||
|
if(this.closed) {
|
||||||
|
return
|
||||||
|
}
|
||||||
if (target) {
|
if (target) {
|
||||||
logger.debug("Failed proxy to target: " + JSON.stringify(target))
|
logger.debug("Failed proxy to target: " + JSON.stringify(target))
|
||||||
if (req.method === "GET" && (!res.statusCode || res.statusCode >= 500)) {
|
if (req.method === "GET" && (!res.statusCode || res.statusCode >= 500)) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user