[glotpress-updates] [GlotPress] #208: String counts caching issues

GlotPress glotpress-updates at lists.automattic.com
Fri Jun 29 20:09:49 UTC 2012

#208: String counts caching issues
 Reporter:  dimadin      |      Owner:
     Type:  defect       |     Status:  new
 Priority:  normal       |  Milestone:
Component:  performance  |    Version:
 Keywords:               |
 After numerous reports on WP Polyglots, I've looked into the GlotPress
 code to see what and where we're caching and when that cache is cleared.

 There are two caches that we have and that affect us:
 active_originals_count_by_project_id which is a number of active strings
 in a project, and translation_set_status_breakdown, which is per
 translation set cache that contains counts of each status of string except
 of untranslated strings.

 First cache is cleared when originals are imported into the project and
 that is fine. Second cache is cleared when new translation is added but
 there are actions that don't clear cache and I believe this is what is
 causing problems.

 Translation set's cache isn't cleared when
 includes/routes/translation.php#L266 single string translation status is
 changed], when [https://glotpress.trac.wordpress.org/browser/trunk/gp-
 includes/things/original.php#L56 originals are imported], and when
 /translation-set.php#L139 translation set is copied from another]. Second
 case is responsible for weird numbers like negative number of untranslated
 strings. (this probably happens when approved strings become obsolete
 during import of originals: in that process count of total strings is
 refreshed while count of untranslated strings is dynamically generated as
 difference between total strings (from clean cache) and count of
 translated strings (from old cache), and if there is larger number of
 translated strings in old cache than new number of total strings, we get
 negative number)

 So I suggest that we clear translation set's cache in functions I linked


Ticket URL: <https://glotpress.trac.wordpress.org/ticket/208>
GlotPress <http://trac.glotpress.org>
Easy comin', easy goin'

More information about the glotpress-updates mailing list