jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/404497 )
Change subject: rdbms: make LoadBalancer::waitForAll() better respect the
timeout
......................................................................
rdbms: make LoadBalancer::waitForAll() better respect the timeout
If several replicas (or even all) had replication stuck, then the
timeout would happen for each server, one after another.
Change-Id: Id5431360b9cde7e5dc0115a1f41b9903003f47c4
---
M includes/libs/rdbms/loadbalancer/LoadBalancer.php
1 file changed, 8 insertions(+), 1 deletion(-)
Approvals:
Krinkle: Looks good to me, approved
jenkins-bot: Verified
diff --git a/includes/libs/rdbms/loadbalancer/LoadBalancer.php
b/includes/libs/rdbms/loadbalancer/LoadBalancer.php
index e80b952..9c5a107 100644
--- a/includes/libs/rdbms/loadbalancer/LoadBalancer.php
+++ b/includes/libs/rdbms/loadbalancer/LoadBalancer.php
@@ -518,6 +518,8 @@
}
public function waitForAll( $pos, $timeout = null ) {
+ $timeout = $timeout ?: $this->mWaitTimeout;
+
$oldPos = $this->mWaitForPos;
try {
$this->mWaitForPos = $pos;
@@ -526,7 +528,12 @@
$ok = true;
for ( $i = 1; $i < $serverCount; $i++ ) {
if ( $this->mLoads[$i] > 0 ) {
- $ok = $this->doWait( $i, true, $timeout
) && $ok;
+ $start = microtime( true );
+ $ok = $this->doWait( $i, true, max( 1,
(int)$timeout ) ) && $ok;
+ $timeout -= ( microtime( true ) -
$start );
+ if ( $timeout <= 0 ) {
+ break; // timeout reached
+ }
}
}
} finally {
--
To view, visit https://gerrit.wikimedia.org/r/404497
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Id5431360b9cde7e5dc0115a1f41b9903003f47c4
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz <[email protected]>
Gerrit-Reviewer: Krinkle <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits