Timed publication failed - how to avoid in future?

Hi everyone,

I run a hobby website on the cantatas of JS Bach (Modx Rev 3 on Modx Cloud), more specifically it follows the days on which those cantatas were first performed (https://whichbachcantata.be).

I create resources with a publish date that matches that calendar, so on the exact day the resource is published, the RSS feed is refreshed and this triggers a Facebook post and a Mailchimp mailing campaign.

This worked nicely most apart for a hickup a long time back, but for some reason last Tuesday it failed. There’s a new resource scheduled for tomorrow, and all seems fine, but of course now I’m suspicious - there was also no clear reason the Tuesday publication would fail.

I tried and search for help but did not really find a lot, so I have a few questions:

  • Is this known to happen? Does it happen a lot?
  • Is there a possible root cause?
  • Is this an indication that other scheduled publications will also fail or was this an exception?
  • Is there something I need to investigate?
  • Is there a way to verify if all is well? A cron job of some sort?
  • Is there a failover way to catch possible failures, a safety belt so to speak?
  • Am I worrying too much? :smile:

Thanks for your help! --Mike

So did this resource never get published at all? Or just too late?

I had to publish it manually - it’s published now. But I didn’t realise in time, so yeah, too late.

Thanks --M.

So the way auto publishing works in MODX is as follows:

A cache file is created (core/cache/auto_publish/auto_publish.cache.php) that returns the next time a resource has to be published/unpublished.

Every time MODX handles a request, this file is checked and if the returned timestamp has been passed, the resources are published/unpublished and the cache is refreshed.


You could check this cache file to see if the stored timestamp is correct.
(There exist online tools to convert the Unix Timestamp into a human readable form.)

OK that timestamp looks perfect… So I should be good?

Thanks --Mike

In theory, yes.
But it’s hard to say without knowing what exactly happened the last time (when it failed).

I haven’t heard of any problems with MODX auto publishing, so I doubt there is a general issue.

I agree auto publishing works well and in my experience, is completely reliable.

The only thing that has ever tripped me up is daylight saving times.

If you don’t have your timezone specified in .htaccess [or somewhere else] then your site can end up an hour off the actual time.

php_value date.timezone 'Europe/London'

… for example.

If your page was still not published beyond the length of your daylight saving difference - then this probably isn’t relevant but it’s good practice anyway.

Another publishing point has passed and now everything worked fine… I’m still stumped as to why it failed last Tuesday and I’ll keep a close eye on it, but thanks for the answers @halftrainedharry @dejaya

Cheers --Mike

1 Like

Only time I have seen the auto-publish seemed to have failed was when my server setup went south (I accidentally misconfigured it) and the front-end was returning 404 for a couple of hours. Since auto-publishing is triggered by page view, no page visit means no auto-publish. As soon as I fixed the issue and web traffic came back, the auto-publish went into action and resources were published. Note that even in this case, "Date Published’ will show intended “Date to Publish” and not the time of actual publishing event. That’s how the code works.

1 Like