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

performance fix when cluster has lots of namespaces

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
This commit is contained in:
Jari Kolehmainen 2020-12-03 13:38:37 +02:00
parent 432b00b8cc
commit 4fffc86e7e

View File

@ -425,17 +425,8 @@ export class Cluster implements ClusterModel, ClusterState {
try { try {
const namespaceList = await api.listNamespace(); const namespaceList = await api.listNamespace();
const nsAccessStatuses = await Promise.all(
namespaceList.body.items.map(ns => this.canI({
namespace: ns.metadata.name,
resource: "pods",
verb: "list",
}))
);
return namespaceList.body.items return namespaceList.body.items.map(ns => ns.metadata.name);
.filter((ns, i) => nsAccessStatuses[i])
.map(ns => ns.metadata.name);
} catch (error) { } catch (error) {
const ctx = this.getProxyKubeconfig().getContextObject(this.contextName); const ctx = this.getProxyKubeconfig().getContextObject(this.contextName);