Skip to content

Commit

Permalink
Always keep preview envs on db activity
Browse files Browse the repository at this point in the history
  • Loading branch information
vulkoingim authored and roboquat committed Jun 7, 2022
1 parent f522d3b commit 5653a5e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .werft/platform-delete-preview-environments-cron.ts
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,11 @@ async function determineStalePreviewEnvironments(options: {previews: PreviewEnvi
werft.done(SLICES.CHECKING_FOR_DB_ACTIVITY)

const previewsToDelete = previews.filter((preview: PreviewEnvironment) => {
if (!previewNamespacesWithNoDBActivity.has(preview.namespace)){
werft.log(SLICES.DETERMINING_STALE_PREVIEW_ENVIRONMENTS, `Considering ${preview.name} (${preview.namespace}) active due to recent DB activity`)
return false
}

if (!previewNamespaceBasedOnBranches.has(preview.namespace)) {
werft.log(SLICES.DETERMINING_STALE_PREVIEW_ENVIRONMENTS, `Considering ${preview.name} (${preview.namespace}) stale due to missing branch`)
return true
Expand Down

0 comments on commit 5653a5e

Please sign in to comment.