Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-16642

Smart groups never refreshed by scheduled jobs


    • Versioning Impact:
      Patch (backwards-compatible bug fixes)
    • Documentation Required?:
    • Funding Source:
      Needs Funding


      I have a CiviCRM with nearly 300 smart groups (and growing).
      Those groups could take several seconds to update so i need to refresh them only once in a while using Scheduled Job "Rebuild Smart Group Cache" with a limit setted to 15.
      The cron run once per hour and the scheduled job is defined to run Always.

      After several days, i have noticed that some smart groups were not updated and yet the scheduled job seems to run fine.

      By debugging, it seems that civicrm_group.cache_date and civicrm_cache.refresh_date are always null which make the "order by" clause to fail giving an arbitrary set of group each time.

      Digging further, it's seems that when the scheduled job is ran, the process go a multiple time through updateCacheTime. The first time with argurment processed=1 which set the cache_date properly, and the next times with processed=0 which set the cache_date to null.

      I don't understand why we even reset the cache_date. It seem like a good idea to always have the latest time the smart group was cached. Am i missing something ?

      I will do a test to see if the problem persist in CiviCRM 4.6.




            • Assignee:
              samuelsov Samuel Vanhove
              samuelsov Samuel Vanhove
            • Votes:
              0 Vote for this issue
              7 Start watching this issue


              • Created: