Cache Not clearing after Publishing through Sitecore Publishing Service

Challenge:

When we moved to our Stage Environment, we setup the Scaled Environment and everything worked absolutely fine and even cache getting cleared and all. Hence, we deployed our code on the Stage CM and CD environments and suddenly, we started facing an issue, where the cache was not getting cleared.

What we checked and how we reached the solution?

So, firstly, a quick info, we had also introduced Sitecore Publishing Service in our Scaled Environment architecture. So even if we had tested and found that the publishing was working previously, we wanted to verify that it happens.

So we went ahead, published some items, and in the Sitecore Desktop, we switched the database and verified that the values were reflected.

Checked – That works!

Next, we went through the different config entries in our solution to see what was it that was that led to the issue that we were facing.

So, to reduce a variable from the equation, we went and disabled the Sitecore Publishing Service and switched back to usual Sitecore Publishing.

How did we do that?

Well, 2 simple steps as per this Knowledge Base article from Sitecore: https://kb.sitecore.net/articles/154093

And now, when we published, we found that the cache was getting cleared successfully and everything was working as expected.

As we all know, the best way to troubleshooting for an issue, is to simply it by reducing or cutting down different variables from the equation and narrowing it down to the problem!

But, as you know, we wanted to use Sitecore Publishing Service for publishing on Stage and Live environments.

While checking all our custom configs we found a Patch applied for a Setting in one of our Sitecore Config file which we felt is worth trying.

The Setting was Publishing.PublishingInstance – it had the value of the Name of our CM Instance.

 

Solution:

So, we went and checked this in our default Sitecore.config, and it was empty.

So, we commented out the patch, directly on the CM and CD Servers, enabled the Publishing Service back and gave it a try, is the cache clearing working?

And Voila! It worked!

Next, we commented that out from our solution so that for future deployments, it remains silent and doesn’t mess with our cache clearing.

<!–<setting name=”Publishing.PublishingInstance”>
<patch:attribute name=”value”>#{SitecoreInstanceName}</patch:attribute>
</setting>–>

Logic on why Publishing.PublishingInstance should not have the CM URL in its value:

So, when we checked the history in our code, we found that long back, there was some issue with our Sitecore version related to Publishing/Indexing/Cache Clearing for one of the Hotfixes we had applied. And as a part of solution to that, we had applied this config patch.

Now, this is what I think, and I maybe completely wrong! So please excuse me if my assumption here is wrong!

Say, when we have Scaled instance, with a Publishing Service, the Publishing will be done by the Publishing Service. But, having the Name of the CM instance in the CD Server configs, would instruct the CDs to clear the cache if a Publishing was fired by the CM and not otherwise.

Hence, when we fired the Publishing disabling the Publishing Service and falling back to Sitecore Publishing, cache clearing worked just fine.

And probably, that is the reason, that when we removed that Instance Name, CD Server started picking up the events of cache clearing i.e. basically publish:complete and publish:complete:remote – and started doing the cache clearing for the items published.

Happy Troubleshooting! 🙂

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.