Skip to content

Commit

Permalink
Remove task only if in CLOSED state (MID-5033)
Browse files Browse the repository at this point in the history
It looks like that when re-scheduling already closed single-run tasks
they keep their completionTimestamp set. And so they are eventually
cleaned up. This is an immediate fix, requiring tasks that are to
be cleaned to have also execution status = CLOSED. See also MID-5133.
  • Loading branch information
mederly authored and skublik committed Feb 7, 2019
1 parent c42d79d commit 089ab32
Showing 1 changed file with 2 additions and 1 deletion.
Expand Up @@ -1802,7 +1802,8 @@ public void cleanupTasks(CleanupPolicyType policy, Task executionTask, Operation
List<PrismObject<TaskType>> obsoleteTasks;
try {
ObjectQuery obsoleteTasksQuery = QueryBuilder.queryFor(TaskType.class, prismContext)
.item(TaskType.F_COMPLETION_TIMESTAMP).le(timeXml)
.item(TaskType.F_EXECUTION_STATUS).eq(TaskExecutionStatusType.CLOSED)
.and().item(TaskType.F_COMPLETION_TIMESTAMP).le(timeXml)
.and().item(TaskType.F_PARENT).isNull()
.build();
obsoleteTasks = repositoryService.searchObjects(TaskType.class, obsoleteTasksQuery, null, result);
Expand Down

0 comments on commit 089ab32

Please sign in to comment.