Problem/Motivation
When a scheduled update is run and is invalid, there is a field option to requeue the update.
Currently, if the update is requeued the item never runs again because of the condition in BaseUpdateRunner::addActiveUpdateConditions() having a commented out STATUS_REQUEUED.
Using WBM as an example: if I have a 3 step workflow, and the update runs when the node is in a state that can't transition to the value in the scheduled update, the transition is considered invalid so won't run.
If the node then gets transitioned to a valid from state, the update should run again.
I've tried uncommenting that line, but it doesn't fix the issue.
This is due to the update still referencing the old revision id, so $entities_to_update = $this->loadEntitiesToUpdate($entity_ids); returns an empty array.
Proposed resolution
Allow items to be requeued.
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | 2738079-requeue-updates-5.patch | 1.59 KB | acbramley |
| #4 | 2738079-requeue-updates-4.patch | 1.35 KB | acbramley |
Comments
Comment #2
acbramley commentedComment #3
acbramley commentedMore information from debugging with the entity id issue:
* I uncommented the line in BaseUpdateRunner::addActiveUpdateConditions() to include STATUS_REQUEUED items
* When running updates that get the requeued updates, and those requeued updates reference a node which has had a new revision since it was requeued:
BaseUpdateRunner::addUpdatesToQueue() correctly adds an update to the queue with the new revision ID.
When BaseUpdateRunner::runUpdatesInQueue() calls $queue->claimItem(), the $update_info array contains the old revision id.
This then fails to load the nodes in LatestRevisionUpdateRunner::loadEntitiesToUpdate
This causes the update to successfully run, but nothing happens.
Comment #4
acbramley commentedThis makes the requeuing work, definitely not optimal but works.
Comment #5
acbramley commentedWe need to remove requeued/invalid items from the queue. I ran this patch for a while and the queue ended up with 1500+ items in it so it would never reach the valid items.
Comment #6
acbramley commentedComment #8
smustgrave commented