Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Use case:
- The same node is updated numerous times per day (either manually or by Feeds import)
- xmlsitemap_node_node_update() creates a new queue item each time the node is updated
- xmlsitemap_node_cron doesn't have a chance to process and delete the queue items for whatever reason (error, cron timeout, etc)
- Numerous queue items persist in the queue table for the same nodes, which creates a queue backlog which thwarts sitemap.xml from updating properly
After installing the very helpful queue_ui module, we discovered over 300,000 queue items for only a few hundred nodes of a particular content type. Yes, we need to figure out the underlying issue, but xmlsitemap doesn't need to create a new queue item for existing, unprocessed items.
I propose checking for a queue item before creating it.
Patch is on its way . . .
Comment | File | Size | Author |
---|---|---|---|
#13 | xmlsitemap-check-for-queue-item-3090637-7.patch | 1.6 KB | bricel |
#2 | xmlsitemap-check-for-queue-item-3090637.patch | 1.21 KB | darkodev |
Comments
Comment #2
darkodev CreditAttribution: darkodev commentedComment #3
jasonmce CreditAttribution: jasonmce commentedIt is a good start, but it appears that an update to node 1 would match queued rows for any nid with a 1 in it (ex: 1234) and be excluded?
You probably want your condition to be the full
data = 's:DIGITS_IN_NID:"NID";'
, but quote wrapping ":data" in your like condition should be just as safe.Comment #4
darkodev CreditAttribution: darkodev commentedGood point, thanks.
Will refactor, test and upload a new patch.I checked and the value for the like condition in my patch already contains the quotes.
The resultant query doesn't select anything except the nid in question.
eg.
select item_id from `queue` where name = 'xmlsitemap_node' and data like '%"1"%'
only selects nid 1
select item_id from `queue` where name = 'xmlsitemap_node' and data like '%"1234"%'
only selects nid 1234
Unless I'm missing something . . .
Comment #5
jasonmce CreditAttribution: jasonmce commentedThere it is! Apologies for the noise.
Comment #6
darkodev CreditAttribution: darkodev commented@jasonmce thanks for second set of eyes
Comment #7
bricel CreditAttribution: bricel as a volunteer commentedAdding support for the advanced queue module.
Comment #8
bricel CreditAttribution: bricel as a volunteer commentedMaking query condition more efficient. The nid is save as is, so need for %like%
Comment #9
bricel CreditAttribution: bricel as a volunteer commentedComment #10
bricel CreditAttribution: bricel as a volunteer commentedCleanup and fixes for patch #2 and #3
Comment #11
bricel CreditAttribution: bricel as a volunteer commentedFix patch.
Comment #12
bricel CreditAttribution: bricel as a volunteer commentedFix query from #5
Comment #13
bricel CreditAttribution: bricel as a volunteer commented