objectcache: Deprecate BagOStuff::addBusyCallback() and reduce to a stub

It's not called by anything since it was removed from
ChronologyProtector, and it is not needed for production.

Pass the timeout directly to LoadBalancer::waitForAll() instead of
using a WaitConditionLoop, as it was before e99bb1b7dc

Change-Id: I5a1903e6e9ac145c06f77c690a0f6a487b4aa43f
This commit is contained in:
Tim Starling 2022-05-26 11:05:10 +10:00 committed by Krinkle
parent bcfb90cdd7
commit dbd52291a0
4 changed files with 6 additions and 27 deletions

View file

@ -273,6 +273,7 @@ because of Phabricator reports.
- ::getUserObj() → ::getUser()
- ::setUserObj() → ::setUsername()
- ::setUserIP() → ::setUsername()
* ObjectCache::addBusyCallback() is deprecated and non-functional.
* …
=== Other changes in 1.39 ===

View file

@ -520,22 +520,12 @@ abstract class BagOStuff implements
/**
* Let a callback be run to avoid wasting time on special blocking calls
*
* The callbacks may or may not be called ever, in any particular order.
* They are likely to be invoked when something WRITE_SYNC is used used.
* They should follow a caching pattern as shown below, so that any code
* using the work will get it's result no matter what happens.
* @code
* $result = null;
* $workCallback = function () use ( &$result ) {
* if ( !$result ) {
* $result = ....
* }
* return $result;
* }
* @endcode
* This is hard-deprecated and non-functional since 1.39. The callback
* will not be called.
*
* @param callable $workCallback
* @since 1.28
* @deprecated since 1.39
*/
abstract public function addBusyCallback( callable $workCallback );

View file

@ -48,9 +48,6 @@ abstract class MediumSpecificBagOStuff extends BagOStuff {
/** @var bool */
private $dupeTrackScheduled = false;
/** @var callable[] */
protected $busyCallbacks = [];
/** @var array[] Map of (key => (PHP variable value, serialized value)) */
protected $preparedValues = [];
@ -805,7 +802,7 @@ abstract class MediumSpecificBagOStuff extends BagOStuff {
}
final public function addBusyCallback( callable $workCallback ) {
$this->busyCallbacks[] = $workCallback;
wfDeprecated( __METHOD__, '1.39' );
}
/**

View file

@ -32,7 +32,6 @@ use Wikimedia\Rdbms\ILoadBalancer;
use Wikimedia\Rdbms\IMaintainableDatabase;
use Wikimedia\ScopedCallback;
use Wikimedia\Timestamp\ConvertibleTimestamp;
use Wikimedia\WaitConditionLoop;
/**
* RDBMS-based caching module
@ -1835,15 +1834,7 @@ class SqlBagOStuff extends MediumSpecificBagOStuff {
return true; // not applicable
}
$loop = new WaitConditionLoop(
static function () use ( $lb, $primaryPos ) {
return $lb->waitForAll( $primaryPos, 1 );
},
$this->syncTimeout,
$this->busyCallbacks
);
return ( $loop->invoke() === $loop::CONDITION_REACHED );
return $lb->waitForAll( $primaryPos, $this->syncTimeout );
} catch ( DBError $e ) {
$this->setAndLogDBError( $e );