While investigating T401157, I noticed that the GitLab MR widget generates writes to the cache table (phabricator_caches.general_cache) for task views by way of a locking mechanism to prevent multiple simultaneous requests to the GitLab API for the same search.
Roughly:
$cache = PhabricatorCaches::getMutableCache(); $changes = $cache->getKey($cachekey, null); if ($changes === "loading") { // Data is being loaded by another request / process, avoid hammering GitLab: return array(); } if (! $changes) { // Attempt to avoid thundering herd - lock the cache by setting it to // "loading" while https request is pending, timeout the cache entry in 5 // seconds: $cache->setKey($cachekey, "loading", 5); // etc. }
Although I'm not sure if it has any bearing on T401157, this is definitely not the smartest thing I've ever done. The getMutableCache() call might be replaceable with a getRuntimeCache() that returns one backed with machine-local APCu, but I'll need to confirm that actually works and is appropriate.