mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Fix Cluster.refresh sometimes taking upwards of 20s (#4826)
- Only read and parse the proxy config once - Reuse the AuthorizationV1Api instance for the entire refresh instead of recreating it between 32 and 302 times, this should allow for reusing sockets Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
1 parent
4abe0d6c20
commit
0745f9c063
6 files changed
+118
-73
No files matched your search
@@ -39,6 +39,8 @@ import { Kubectl } from "../kubectl/kubectl";
|
||||
import { getDiForUnitTesting } from "../getDiForUnitTesting";
|
||||
import type { ClusterModel } from "../../common/cluster-types";
|
||||
import { createClusterInjectionToken } from "../../common/cluster/create-cluster-injection-token";
|
||||
import authorizationReviewInjectable from "../../common/cluster/authorization-review.injectable";
|
||||
import listNamespacesInjectable from "../../common/cluster/list-namespaces.injectable";
|
||||
|
||||
console = new Console(process.stdout, process.stderr); // fix mockFS
|
||||
|
||||
@@ -77,6 +79,9 @@ describe("create clusters", () => {
|
||||
|
||||
await di.runSetups();
|
||||
|
||||
di.override(authorizationReviewInjectable, () => () => () => Promise.resolve(true));
|
||||
di.override(listNamespacesInjectable, () => () => () => Promise.resolve([ "default" ]));
|
||||
|
||||
createCluster = di.inject(createClusterInjectionToken);
|
||||
|
||||
jest.spyOn(Kubectl.prototype, "ensureKubectl").mockReturnValue(Promise.resolve(true));
|
||||
@@ -117,7 +122,6 @@ describe("create clusters", () => {
|
||||
} as any;
|
||||
|
||||
jest.spyOn(cluster, "reconnect");
|
||||
jest.spyOn(cluster, "canI");
|
||||
jest.spyOn(cluster, "refreshConnectionStatus");
|
||||
|
||||
await cluster.activate();
|
||||
|
||||
Reference in new issue
Block a user