mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Close Lens Proxy on quit of backend (#7453)
- Extract global shared state of shell sessions Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
1 parent
2884dea195
commit
908a3cabe1
8 files changed
+99
-31
No files matched your search
@@ -0,0 +1,21 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import { beforeQuitOfBackEndInjectionToken } from "../start-main-application/runnable-tokens/phases";
|
||||
import lensProxyInjectable from "./lens-proxy.injectable";
|
||||
|
||||
const closeLensProxyOnQuitInjectable = getInjectable({
|
||||
id: "close-lens-proxy-on-quit",
|
||||
instantiate: (di) => ({
|
||||
run: async () => {
|
||||
const lensProxy = di.inject(lensProxyInjectable);
|
||||
|
||||
await lensProxy.close();
|
||||
},
|
||||
}),
|
||||
injectionToken: beforeQuitOfBackEndInjectionToken,
|
||||
});
|
||||
|
||||
export default closeLensProxyOnQuitInjectable;
|
||||
@@ -48,7 +48,7 @@ export function isLongRunningRequest(reqUrl: string) {
|
||||
|
||||
/**
|
||||
* This is the list of ports that chrome considers unsafe to allow HTTP
|
||||
* conntections to. Because they are the standard ports for processes that are
|
||||
* connections to. Because they are the standard ports for processes that are
|
||||
* too forgiving in the connection types they accept.
|
||||
*
|
||||
* If we get one of these ports, the easiest thing to do is to just try again.
|
||||
@@ -166,10 +166,17 @@ export class LensProxy {
|
||||
}
|
||||
|
||||
close() {
|
||||
if (this.closed) {
|
||||
return;
|
||||
}
|
||||
|
||||
// mark as closed immediately
|
||||
this.closed = true;
|
||||
this.dependencies.logger.info("[LENS-PROXY]: Closing server");
|
||||
|
||||
this.proxyServer.close();
|
||||
this.closed = true;
|
||||
return new Promise<void>((resolve) => {
|
||||
this.proxyServer.close(() => resolve());
|
||||
});
|
||||
}
|
||||
|
||||
protected configureProxy(proxy: httpProxy): httpProxy {
|
||||
|
||||
Reference in new issue
Block a user