I have a really horrible intermittent bug where a collection of nodes will reset to a previous revision.
Here is an image of the revisions tab on the node:
Image may be NSFW.
Clik here to view.
There are three unusual aspects:
- The ‘current revision’ is at the bottom of the list and has lower vid than the rest.
- The date of the ‘current revision’ is yesterday but the low vid implies it was created a while ago.
- The revision log says “Updated by FeedsNodeProcessor” yesterday but the Feeds log tells me “Last run 1 week ago”.
I’m hoping someone can point me in the right direction on where to look for a cause since I can’t replicate the behaviour.
It feels like the vid in the {node} table has been changed. Along with the created date and revision timestamp. I’m really not sure how that could happen, though…
EDIT: Current Hypothesis
I have a custom module that updates a field. It uses a cron queue, so I’m wondering if the queue contains stale node data:
/**
* Implements hook_cron().
*/
function ih_transcript_import_cron() {
// Load all Video nodes.
$videos = ih_transcript_import_load_video_nodes();
$queue = DrupalQueue::get('ih_video_transcripts');
foreach($videos as $video) {
$queue->createItem($video);
}
}
In my queue’s 'worker callback'
, I should probably reload the node in case the object has been left in the queue for some time? And ensure I set $node->revision = TRUE
before node_save
?