diff --git a/src/main/java/com/epam/reportportal/jobs/clean/CleanAttachmentJob.java b/src/main/java/com/epam/reportportal/jobs/clean/CleanAttachmentJob.java index a2f6fc7..80a0b0e 100644 --- a/src/main/java/com/epam/reportportal/jobs/clean/CleanAttachmentJob.java +++ b/src/main/java/com/epam/reportportal/jobs/clean/CleanAttachmentJob.java @@ -22,8 +22,8 @@ WITH moved_rows AS ( DELETE FROM attachment\s WHERE project_id = ?\s AND creation_date <= ?::TIMESTAMP\s - AND launch_id IN ( - SELECT id FROM launch WHERE retention_policy='REGULAR' + AND launch_id NOT IN ( + SELECT id FROM launch WHERE retention_policy='IMPORTANT' )\s RETURNING * ) diff --git a/src/main/java/com/epam/reportportal/jobs/clean/CleanLogJob.java b/src/main/java/com/epam/reportportal/jobs/clean/CleanLogJob.java index 55fa6c1..8d5da38 100644 --- a/src/main/java/com/epam/reportportal/jobs/clean/CleanLogJob.java +++ b/src/main/java/com/epam/reportportal/jobs/clean/CleanLogJob.java @@ -60,7 +60,6 @@ public CleanLogJob(JdbcTemplate jdbcTemplate, CleanAttachmentJob cleanAttachment @SchedulerLock(name = "cleanLog", lockAtMostFor = "24h") public void execute() { removeLogs(); - cleanAttachmentJob.moveAttachments(); } void removeLogs() { @@ -83,6 +82,7 @@ void removeLogs() { } } }); + cleanAttachmentJob.moveAttachments(); } private void deleteLogsFromSearchEngineByLaunchIdsAndProjectId(List launchIds,