From 624753f84000dd28de220b01f0da654de80fc1af Mon Sep 17 00:00:00 2001 From: Derek Horton Date: Sat, 23 Nov 2024 20:36:51 -0600 Subject: [PATCH] Re-work the order of the cleanup operations --- deployments/clowdapp.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/deployments/clowdapp.yml b/deployments/clowdapp.yml index 978c615..7d67ba7 100644 --- a/deployments/clowdapp.yml +++ b/deployments/clowdapp.yml @@ -177,9 +177,7 @@ objects: #psql -c "DELETE FROM payload_statuses WHERE created_at < (NOW() - interval '$RETENTION_DAYS days');" #psql -c "VACUUM ANALYZE payload_statuses;" - psql -c "DELETE FROM payloads WHERE created_at < (NOW() - interval '$RETENTION_DAYS days');" - psql -c "VACUUM ANALYZE payloads;" - + for i in $(seq 1 ${MAX_NUMBER_OF_RETRIES}) do echo "Creating partition" @@ -188,8 +186,16 @@ objects: psql -c "SELECT create_partition(NOW()::DATE + INTERVAL '1 DAY', NOW()::DATE + INTERVAL '2 DAY');" && break || sleep $SLEEP_TIME done + echo "Deleting partition" psql -c "SELECT drop_partition(NOW()::DATE - INTERVAL '$RETENTION_DAYS DAY', NOW()::DATE - (($RETENTION_DAYS - 1) || ' DAY')::INTERVAL);" + echo "Deleting payloads" + psql -c "DELETE FROM payloads WHERE created_at < (NOW() - interval '$RETENTION_DAYS days');" + + echo "Vacuuming payloads" + psql -c "VACUUM ANALYZE payloads;" + + parameters: - description: Initial amount of memory the payload-tracker container will request. displayName: Memory Request