timeout adjusted

pull/437/head
Frostebite 2022-11-01 23:16:12 +00:00
parent 3db12146a1
commit 3b5b53e0f5
3 changed files with 11 additions and 25 deletions

13
dist/index.js vendored
View File

@ -3121,7 +3121,6 @@ class Kubernetes {
yield this.kubeClientBatch.deleteNamespacedJob(this.jobName, this.namespace);
yield this.kubeClient.deleteNamespacedPod(this.podName, this.namespace);
yield this.kubeClient.deleteNamespacedSecret(this.secretName, this.namespace);
yield new Promise((promise) => setTimeout(promise, 15000));
cloud_runner_logger_1.default.log('cleaned up Secret, Job and Pod');
}
catch (error) {
@ -3147,18 +3146,12 @@ class Kubernetes {
}
cloud_runner_logger_1.default.log(`deleting PVC`);
try {
const promise = this.kubeClient.deleteNamespacedPersistentVolumeClaim(this.pvcName, this.namespace);
// eslint-disable-next-line github/no-then
promise.catch((error) => {
if (error.response.body.reason === `not found`) {
return;
yield this.kubeClient.deleteNamespacedPersistentVolumeClaim(this.pvcName, this.namespace);
}
catch (error) {
cloud_runner_logger_1.default.log(`Cleanup failed ${JSON.stringify(error, undefined, 4)}`);
});
yield promise;
// eslint-disable-next-line no-empty
throw error;
}
catch (_a) { }
});
}
static findPodFromJob(kubeClient, jobName, namespace) {

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -219,7 +219,6 @@ class Kubernetes implements ProviderInterface {
await this.kubeClientBatch.deleteNamespacedJob(this.jobName, this.namespace);
await this.kubeClient.deleteNamespacedPod(this.podName, this.namespace);
await this.kubeClient.deleteNamespacedSecret(this.secretName, this.namespace);
await new Promise((promise) => setTimeout(promise, 15000));
CloudRunnerLogger.log('cleaned up Secret, Job and Pod');
} catch (error: any) {
if (error.response.body.reason === `not found`) {
@ -247,17 +246,11 @@ class Kubernetes implements ProviderInterface {
CloudRunnerLogger.log(`deleting PVC`);
try {
const promise = this.kubeClient.deleteNamespacedPersistentVolumeClaim(this.pvcName, this.namespace);
// eslint-disable-next-line github/no-then
promise.catch((error: any) => {
if (error.response.body.reason === `not found`) {
return;
}
await this.kubeClient.deleteNamespacedPersistentVolumeClaim(this.pvcName, this.namespace);
} catch (error: any) {
CloudRunnerLogger.log(`Cleanup failed ${JSON.stringify(error, undefined, 4)}`);
});
await promise;
// eslint-disable-next-line no-empty
} catch {}
throw error;
}
}
static async findPodFromJob(kubeClient: CoreV1Api, jobName: string, namespace: string) {