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 f45344c commit bccb9d0
Showing 1 changed file with 2 additions and 1 deletion.
Expand Up @@ -2151,7 +2151,8 @@ public void cleanupTasks(CleanupPolicyType policy, Task executionTask, Operation
List<PrismObject<TaskType>> obsoleteTasks;
try {
ObjectQuery obsoleteTasksQuery = prismContext.queryFor(TaskType.class)
.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 bccb9d0

Please sign in to comment.