Fix slow callbacks in getWithSetCallback() using lockTSE
authorAaron Schulz <aschulz@wikimedia.org>
Fri, 23 Oct 2015 02:36:59 +0000 (19:36 -0700)
committerKrinkle <krinklemail@gmail.com>
Wed, 28 Oct 2015 23:31:37 +0000 (23:31 +0000)
commit6d0108d533f0128188b6358ecf94ea5e59d0db15
tree2b1a37f5901875bc2564a4361710bda6504edfa4
parent13a35dac582cf44ce8e2b6f3e9448b4b6c6f3874
Fix slow callbacks in getWithSetCallback() using lockTSE

* Keys that take a long time to generate would run into
  the MAX_SNAPSHOT_LAG check and have set() no-op. This
  would be fine except that leaves no key there to figure
  out the time since expiry and therefore whether to use
  the mutex, so it didn't. This now saves the keys but with
  a FLG_STALE bit set, making the next caller that sees it
  perform a regeneration (unless it can't get the mutex).
* Bumped LOCK_TTL so that keys can stay locked much longer.
* This is easy to test via sleep(5) in tagUsageStatistics()
  and two Special:Tags browser tabs.

Bug: T91535
Change-Id: I549e70ace3d2e7da40d3c4346ebacc36024cd522
includes/libs/objectcache/WANObjectCache.php
tests/phpunit/includes/libs/objectcache/WANObjectCacheTest.php