1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Always end watch stream if connection to kube-api ends (#217)

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
This commit is contained in:
Jari Kolehmainen 2020-04-04 18:26:42 +03:00 committed by GitHub
parent 1c2298f2af
commit 2593f70184
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 12 deletions

View File

@ -156,7 +156,7 @@ export class LensProxy {
if (proxyTarget) {
proxy.web(req, res, proxyTarget)
} else {
await this.router.route(cluster, req, res)
this.router.route(cluster, req, res)
}
})
}

View File

@ -96,8 +96,8 @@ export class Router {
const type = mimeTypes[path.extname(asset).slice(1)] || "text/plain";
response.setHeader("Content-Type", type);
response.write(data)
response.end()
}
response.end()
})
}

View File

@ -49,16 +49,13 @@ class ApiWatcher {
}
private doneHandler(error: Error) {
if (error) {
logger.error("watch error: " + error.toString())
if (error) logger.warn("watch ended: " + error.toString())
this.sendEvent({
type: "STREAM_END",
url: this.apiUrl,
status: 410,
})
return
}
this.start()
}
private sendEvent(evt: any) {