diff --git a/java/code/src/com/redhat/rhn/taskomatic/task/MinionActionExecutor.java b/java/code/src/com/redhat/rhn/taskomatic/task/MinionActionExecutor.java index 114079b4eb97..a659b71076e9 100644 --- a/java/code/src/com/redhat/rhn/taskomatic/task/MinionActionExecutor.java +++ b/java/code/src/com/redhat/rhn/taskomatic/task/MinionActionExecutor.java @@ -15,6 +15,7 @@ package com.redhat.rhn.taskomatic.task; import com.redhat.rhn.GlobalInstanceHolder; +import com.redhat.rhn.common.hibernate.HibernateFactory; import com.redhat.rhn.common.localization.LocalizationService; import com.redhat.rhn.domain.action.Action; import com.redhat.rhn.domain.action.ActionFactory; @@ -121,7 +122,16 @@ public void execute(JobExecutionContext context) { // COMMITted in the database. Wait for some minutes checking if it appears int waitedTime = 0; while (countQueuedServerActions(action) == 0 && waitedTime < ACTION_DATABASE_GRACE_TIME) { + if (action != null) { + HibernateFactory.getSession().flush(); + HibernateFactory.getSession().evict(action); + } + action = ActionFactory.lookupById(actionId); + + if (log.isDebugEnabled()) { + log.debug("Number of Queued Server Actions for {}: {}", actionId, countQueuedServerActions(action)); + } try { Thread.sleep(ACTION_DATABASE_POLL_TIME); } diff --git a/java/spacewalk-java.changes.welder.fix-failed-actions-reschedule b/java/spacewalk-java.changes.welder.fix-failed-actions-reschedule new file mode 100644 index 000000000000..50552f743a61 --- /dev/null +++ b/java/spacewalk-java.changes.welder.fix-failed-actions-reschedule @@ -0,0 +1 @@ +- Fix failed actions rescheduling (bsc#1214121)