Hi

In hook_flush_caches() there is a piece of logic that checks if it was called by cron. It does this by checking lock_may_be_available('cron').

The problem with that approach, is that it spans across requests. So whenever cron is running, hook_flush_caches() will not flush, regardless of being called from cron or not.

Perhaps a better approach could be to check $_SERVER['PHP_SELF'] for 'cron.php'?

Comments

Status:Active» Needs review
StatusFileSize
new2.76 KB

Here's a patch...

Can you give more information on how lock_may_be_available('cron') may span across requests?

Does checking for cron.php explicitely also work when the cron is called from drush?

Thanks for the patch.

StatusFileSize
new3.72 KB

Hi bgm

One of the main purposes of a lock/semaphore is that it's available across requests, so one may take concurrency into consideration. The lock is stored in the DB (or memcache or other backend). It's available to whoever asks for it. So if cron is running, and you then invoke the flush_caches, then Boost will not flush its caches, because it thinks cron is running ... because cron __is__ running, just in another request.

The patch didn't support Drush, well spotted. I've added a new patch that supports Drush as well.

Any news on this?