chore: Move disconnecting cluster connections to own runnable

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton committed 2023-04-12 15:15:36 -04:00
1 parent 980b054fad
commit 1581da458d
5 files changed
+24 -46

No files matched your search

@@ -226,14 +226,6 @@ export class ClusterManager {
)),
);
};
stop() {
for (const cluster of this.dependencies.clusters.get()) {
this.dependencies
.getClusterConnection(cluster)
.disconnect();
}
}
}
export function catalogEntityFromCluster(cluster: Cluster) {
@@ -0,0 +1,24 @@
/**
* 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 clustersInjectable from "../../features/cluster/storage/common/clusters.injectable";
import { onQuitOfBackEndInjectionToken } from "../start-main-application/runnable-tokens/phases";
import clusterConnectionInjectable from "./cluster-connection.injectable";
const stopAllClusterConnectionsOnQuitInjectable = getInjectable({
id: "stop-all-cluster-connections-on-quit",
instantiate: (di) => ({
run: () => {
const clusters = di.inject(clustersInjectable).get();
for (const cluster of clusters) {
di.inject(clusterConnectionInjectable, cluster).disconnect();
}
},
}),
injectionToken: onQuitOfBackEndInjectionToken,
});
export default stopAllClusterConnectionsOnQuitInjectable;