Sitecore Publishing Service tips and tricks

I have been using Sitecore Publishing Service 3.1.3 in Sitecore 9.0.2 for a while in a big solution and I have encounter different problems in the past months.

Here are some tips and tricks that will help you too.

#1 If you want to see more detailed information in the log files, without much fuss, you have to edit \config\sitecore\sc.logging.xml and replace this

<Sitecore>Information</Sitecore>

with

<Sitecore>Debug</Sitecore>

Please note that you will have to restart your Publishing Service after changing the configuration to apply it. If you are in the middle of the publishing it will start again with the job that was running and will execute it and then execute whatever was already in the Queued jobs list. After you have analyzed your logs do not forget to  revert the change, as in time with this setting will fill up your disk.

#2 If you have made lots of publishing into your solution and things started to pile up you might get a much bigger table Publishing_PublisherOperation then you need to investigate. In the logs I had this:

2019-05-06 08:15:01.147 +02:00 [Information] Executing Cleanup Task : "PublishJobCleanupTask-0cefad14c0664e1d8c114e55bef1007d"
2019-05-06 08:15:03.122 +02:00 [Information] Cleanup Task Complete. Cleaned up 40 job(s).
2019-05-06 08:15:11.154 +02:00 [Information] Executing Cleanup Task : "PublishOperationCleanupTask-33d69c5bc36a457caab958fbc3d7e757"
2019-05-06 08:17:16.198 +02:00 [Error] Error processing scheduled task : "PublishOperationCleanupTask-33d69c5bc36a457caab958fbc3d7e757"
System.Data.SqlClient.SqlException (0x80131904): Execution Timeout Expired. The timeout period elapsed prior to completion of the operation or the server is not responding.

By default, this task uses a command timeout of 120 seconds while trying to delete old records.
This timeout is defined as CommandTimeout for the sql-backend-default DB connection behavior in the \config\sitecore\publishing\sc.publishing.xml file by default.
I suggest you try increasing this timeout to allow PublishOperationCleanupTask more time to delete old records.
Please note that you will have to restart your Publishing Service after changing the configuration to apply it.
I would also like to mention that such an increased command timeout might be not needed after the accumulated extra records are deleted.

#3 If have removed or renamed a language from your Sitecore solution some elements can remain to hang in the table Publishing_PublisherOperation. For instance we have in there rows that have Language code ja-jp when in Sitecore we have ja.

Overall, deleting those rows simply means that the corresponding items will not be checked during incremental publishing in that language (e.g. ja-jp).
Since you don’t use those specific languages in your Sitecore instance and the records themselves are quite old, it should be safe to just delete those rows.

The mentioned records can be added if an item has a version in a language (e.g. ja-jp) that is not registered under /sitecore/system/Languages.
Such behavior ensures that the information about item changes is saved even if the language wasn’t added under /sitecore/system/Languages yet (but you can always add it later).

Nevertheless, it seems like such records might be kept in the database for a long time and thus become outdated in some cases.

#4 Also might happen when you have a scaled environment that when using Publish related items option your related items are not getting published.

The LinkDatabase is used by Publishing Service to get a list of the related items. By default, Publishing Service expects that the connectionStringName of the LinkDatabase is set to core. The Publishing Service Installation Guide (Scaled Environment Considerations section) has the following line:

If you are running the Publishing Service in a scaled environment and if your Links Data is stored in a different database than the Core database, you must update the Publishing Service configuration accordingly.

So you have to perform necessary changes in file \config\sitecore\publishing\sc.publishing.xml and for example, if the Links Data is stored in the Web database, then the Publishing Service configuration needs the following override:

<DefaultConnectionFactory>
  <Options>
     <Connections>
       <Links>
          <Type>Sitecore.Framework.Publishing.Data.AdoNet.SqlDatabaseConnection, Sitecore.Framework.Publishing.Data</Type>
          <Options>
            <ConnectionString>${Sitecore:Publishing:ConnectionStrings:Web}</ConnectionString>
          </Options>
      </Links>

Again, please note that you will have to restart your Publishing Service after changing the configuration to apply it.

#5 To access your Publishing Service website, enter http://<sitename>/api/publishing/operations/status in your browser.
If you receive a value of { "Status" : 0 }, the application is installed correctly. If you receive any other value, check the application logs for further details.

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.