Skip to content

Commit

Permalink
Re-work the order of the cleanup operations (#230)
Browse files Browse the repository at this point in the history
  • Loading branch information
dehort authored Nov 24, 2024
1 parent b3d2ed7 commit f5f4737
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions deployments/clowdapp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
Expand Down

0 comments on commit f5f4737

Please sign in to comment.