String counts caching issues
|Reported by:||dimadin||Owned by:||markoheijnen|
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 single string translation status is changed, when originals are imported, and when 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 above.
Change History (11)
comment:4 markoheijnen — 15 months ago
- Owner set to markoheijnen
- Status changed from new to accepted