Fix ClusterView bugs (#2928)

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
This commit is contained in:
Jari Kolehmainen authored and GitHub committed 2021-06-01 09:32:42 -04:00
1 parent e1be10b74d
commit 06612409ef
2 files changed
+24 -14

No files matched your search

@@ -56,8 +56,13 @@ export async function initView(clusterId: ClusterId) {
parentElem.appendChild(iframe);
logger.info(`[LENS-VIEW]: waiting cluster to be ready, clusterId=${clusterId}`);
await cluster.whenReady;
await autoCleanOnRemove(clusterId, iframe);
try {
await when(() => cluster.ready, { timeout: 5_000 }); // we cannot wait forever because cleanup would be blocked for broken cluster connections
logger.info(`[LENS-VIEW]: cluster is ready, clusterId=${clusterId}`);
} finally {
await autoCleanOnRemove(clusterId, iframe);
}
}
export async function autoCleanOnRemove(clusterId: ClusterId, iframe: HTMLIFrameElement) {