I've been testing this module and it appears that the fields aren't being updated on cron run. I have Drupal's cron setting set to run every 1 hour. Would be great to get this fixed...or do I have to use my server cron function?

CommentFileSizeAuthor
#3 cron_clear_piwikcache-1902742-3.patch431 bytespatrickd
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

patrickd’s picture

Status: Active » Postponed (maintainer needs more info)

Are you sure that the statistics have changed since the last cron run?
Why are you sure that they've not been updated?

Is the option "Fill piwik fields on cron run" ticked on? (admin/config/system/piwik -> Advanced options)

Does Filling the fields manually by pressing the "Fill statistical Piwik fields" button help?

Sorry I need more information, to help you here

infines’s picture

Yes I'm sure the statistics have changed since the last cron run.

I check the statistics pages to find the same numbers as before. (e.g. - hits are still the same number)

Yes the Fill piwik fields on cron run is ticked.

Yes filling the fields manually works.

patrickd’s picture

Status: Postponed (maintainer needs more info) » Needs review
FileSize
431 bytes

See #1742672: Hardcoded cache lifetime in function piwik_stats_get_xml_data, all statistics are cached for a certain time.
Otherwise it's not possible to update the statistics on cron run in a queued method.
(The XML files pulled from piwik can be large and it may take multiple cron-runs to process it completely)

But we can make sure that after a complete processing of the XML file the cache is cleared.

Please check whether the following patch refreshes your statistics more frequently

infines’s picture

Shouldn't the statistics be cached according to the drupal cache lifetime set by the user? Or is this more of a Piwik thing?

patrickd’s picture

I don't understand the question, sorry?

// edit: no this is piwik specific caching

infines’s picture

Okay, I'll test the patch today and let you know this afternoon/tonight.

infines’s picture

Yes this patch seems to be working wonderfully. However I want to continue testing as I noticed my slight loading slowly after the patch was applied (however this could be my office's poor internet connection). I'll let you know later today.

patrickd’s picture

okay! thanks :)

infines’s picture

Status: Needs review » Reviewed & tested by the community

Everything works fantastic now, thank you! Just one more question what does the "Time to spend filling fields" option indicate? Is it the amount of time that a cron run will spend processing stat updates for a queue of entities (user or node)? Did we eliminate this option with the current patch? If so, would it be better to change this to a number of entities to process at a time (e.g. 10, 100, 1000, or 5000)? Please direct me to any issues with these answers! I have no problem writing documentation!

patrickd’s picture

Title: Cron option not working! » Clearing piwik XML cache after completely processing it
Status: Reviewed & tested by the community » Fixed

Committed and pushed to 7.x-2.x!

Yes that's what it stands for.
The API for queued cron processing only allows to set a maximum time of seconds to run, not the entities to process itself:

hook_cron_queue_info()
'time': (optional) How much time Drupal should spend on calling this worker in seconds. Defaults to 15.

I actually think that it makes more sense to specify how much time it should take - not how much entities it should process,
because the problem is PHP's maximum runtime setting.
See max_execution_time: http://www.php.net/manual/en/info.configuration.php#ini.max-execution-time

thanks!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.