From dce797d8761dd9bb8dcc32bc285cbfb278b6e409 Mon Sep 17 00:00:00 2001 From: hannah-macdonald1 Date: Fri, 2 Feb 2024 11:31:37 -0700 Subject: [PATCH] change to check pvc access --- containers/db_cleanup/cleanup.js | 8 ++++++-- .../db_cleanup/openshift/templates/db-cleanup-dc.yaml | 6 +++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/containers/db_cleanup/cleanup.js b/containers/db_cleanup/cleanup.js index d85face..6a72f4a 100644 --- a/containers/db_cleanup/cleanup.js +++ b/containers/db_cleanup/cleanup.js @@ -111,6 +111,10 @@ function async_pin_output() { })(); +function sleep(ms) { + return new Promise((resolve) => setTimeout(resolve, ms)); +} + // Entry deletion function function delete_entries() { pg('vhers_audit_log').where('created_at', '<', retainUntilString).delete().then( @@ -119,8 +123,8 @@ function delete_entries() { () => { vhersClient.end(); pinClient.end(); - console.log(`Successfully deleted audit log entries prior to ${retainUntilString}`); - process.exit(0); + sleep(240000).then(() => {console.log(`Successfully deleted audit log entries prior to ${retainUntilString}`); + process.exit(0);}) }, (err) => { console.log(err); diff --git a/containers/db_cleanup/openshift/templates/db-cleanup-dc.yaml b/containers/db_cleanup/openshift/templates/db-cleanup-dc.yaml index b2e118e..d851a27 100644 --- a/containers/db_cleanup/openshift/templates/db-cleanup-dc.yaml +++ b/containers/db_cleanup/openshift/templates/db-cleanup-dc.yaml @@ -68,9 +68,9 @@ objects: metadata: name: db-cleanup-cronjob spec: - schedule: "30 2 * * SUN" + # schedule: "30 2 * * SUN" # Different schedule for test purposes - # schedule: "*/5 * * * *" + schedule: "*/5 * * * *" startingDeadlineSeconds: 200 concurrencyPolicy: Forbid successfulJobsHistoryLimit: 3 @@ -89,7 +89,7 @@ objects: imagePullPolicy: Always volumeMounts: - mountPath: "/deleted" - name: deleted + name: output env: # Use environment variables for Secret values - name: DB_NAME valueFrom: