-
Type: Bug
-
Status: Open
-
Priority: Minor
-
Resolution: Unresolved
-
Affects Version/s: 5.8
-
Fix Version/s: QualifiedToSchedule
-
Component/s: Events / Works
-
Tags:
-
Sprint:Sprint RepoTeam 5.9.4-1, Sprint RepoTeam 5.9.4-2
When scheduling a work after commit outside a transaction, then the work is never run and stay in the queue indefinitely.
This is reproducible with a unit unit test annotated with
@TransactionalConfig(autoStart=false)
The schedule method should throw an exception if afterCommit=true.
Also the default behaviour is afterCommit=false which is a quite uncommon use case, I suggest:
diff --git i/nuxeo-core-event/src/main/java/org/nuxeo/ecm/core/work/WorkManagerImpl.java w/nuxeo-core-event/src/main/java/org/nuxeo/ecm/core/work/WorkManagerImpl.java index 3758a8b..4ee68d2 100644 --- i/nuxeo-core-event/src/main/java/org/nuxeo/ecm/core/work/WorkManagerImpl.java +++ w/nuxeo-core-event/src/main/java/org/nuxeo/ecm/core/work/WorkManagerImpl.java @@ -747,7 +747,7 @@ public class WorkManagerImpl extends DefaultComponent implements WorkManager { @Override public void schedule(Work work) { - schedule(work, Scheduling.ENQUEUE, false); + schedule(work, Scheduling.ENQUEUE, true); } @Override @@ -757,7 +757,7 @@ public class WorkManagerImpl extends DefaultComponent implements WorkManager { @Override public void schedule(Work work, Scheduling scheduling) { - schedule(work, scheduling, false); + schedule(work, scheduling, true); } @Override