The replaces the hacky use of onTransactionIdle(), which no longer runs
immediately in explicit transaction rounds since d4c31cf841.
Also clarified TransactionRoundDefiningUpdate comment about rounds.
Change-Id: Ie17eacdcaea4e47019cc94e1c7beed9d7fec5cf2
30 lines
635 B
PHP
30 lines
635 B
PHP
<?php
|
|
|
|
/**
|
|
* Deferrable update that must run outside of any explicit LBFactory transaction round
|
|
*
|
|
* @since 1.31
|
|
*/
|
|
class TransactionRoundDefiningUpdate implements DeferrableUpdate, DeferrableCallback {
|
|
/** @var callable|null */
|
|
private $callback;
|
|
/** @var string */
|
|
private $fname;
|
|
|
|
/**
|
|
* @param callable $callback
|
|
* @param string $fname Calling method
|
|
*/
|
|
public function __construct( callable $callback, $fname = 'unknown' ) {
|
|
$this->callback = $callback;
|
|
$this->fname = $fname;
|
|
}
|
|
|
|
public function doUpdate() {
|
|
call_user_func( $this->callback );
|
|
}
|
|
|
|
public function getOrigin() {
|
|
return $this->fname;
|
|
}
|
|
}
|