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.
I have a scheduler which imports articles at a specific time. I can see the content is getting scheduled properly using the scheduled tab but I cannot see the published content. Every morning I need to manually clear the cache to see the scheduled content published otherwise all node goes to 403. Any Idea on this? I tried clearing node tag cache on Scheduler publish event but still didn't worked. Any idea?
Also, I noticed when clearing memcache resolves the issue. I tried to clear the node:nid cache tag on schedule publish event but still didn't worked.
Any idea?
public function onSchedulePublish(SchedulerEvent $event) {
/** @var \Drupal\node\Entity\Node $node */
$node = $event->getNode();
Cache::invalidateTags($node->getCacheTagsToInvalidate());
$message = "Node Published and invalidate the cache tags" . $node->id();
$this->logger->notice($message);
}
Comments
Comment #2
Dinesh18 CreditAttribution: Dinesh18 as a volunteer and at Singapore Press Holdings commentedI used CTC clear cache tag module to see which all cache tag can help to clear the necessary cache.
I tried node:nid and node_values and it worked.
Comment #3
jonathan1055 CreditAttribution: jonathan1055 as a volunteer commentedHi Dinesh,
In principle Scheduler works properly, there are no cache problems. So this is a normal support request, not a critical bug. There must be some other module or set-up on your site which is doing things with caching. It sounds like you have some ideas for your investigations.
Comment #4
Dinesh18 CreditAttribution: Dinesh18 as a volunteer and at Singapore Press Holdings commentedI fixed the issue by using the below code
Comment #5
jonathan1055 CreditAttribution: jonathan1055 as a volunteer commentedThat's good to hear. Thanks for posting your result.
Comment #6
Dinesh18 CreditAttribution: Dinesh18 as a volunteer and at Singapore Press Holdings commentedThank you @jonathan1055 for the support.
Comment #7
jonathan1055 CreditAttribution: jonathan1055 as a volunteer commentedPleased to help, both here are previously on Slack.
Just altering the title to make it easier for others to search and find.