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

fix sleep/resume

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
This commit is contained in:
Jari Kolehmainen 2021-02-11 13:26:08 +02:00
parent f70b3cff11
commit 4290fc5132

View File

@ -300,6 +300,7 @@ export abstract class KubeObjectStore<T extends KubeObject = any> extends ItemSt
// api has gone, let's not retry // api has gone, let's not retry
return; return;
} else { // not sure what to do, best to retry } else { // not sure what to do, best to retry
if (timedRetry) clearTimeout(timedRetry);
timedRetry = setTimeout(() => { timedRetry = setTimeout(() => {
api.watch({ api.watch({
namespace, namespace,
@ -309,6 +310,7 @@ export abstract class KubeObjectStore<T extends KubeObject = any> extends ItemSt
}, 5000); }, 5000);
} }
} else if (error instanceof KubeStatus && error.code === 410) { } else if (error instanceof KubeStatus && error.code === 410) {
if (timedRetry) clearTimeout(timedRetry);
// resourceVersion has gone, let's try to reload // resourceVersion has gone, let's try to reload
timedRetry = setTimeout(() => { timedRetry = setTimeout(() => {
(namespace === "" ? this.loadAll({ merge: false }) : this.loadAll({namespaces: [namespace]})).then(() => { (namespace === "" ? this.loadAll({ merge: false }) : this.loadAll({namespaces: [namespace]})).then(() => {
@ -319,6 +321,16 @@ export abstract class KubeObjectStore<T extends KubeObject = any> extends ItemSt
}); });
}); });
}, 1000); }, 1000);
} else { // not sure what to do, best to retry
if (timedRetry) clearTimeout(timedRetry);
timedRetry = setTimeout(() => {
api.watch({
namespace,
abortController,
callback
});
}, 5000);
} }
if (data) { if (data) {