Chad has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/106443


Change subject: Make it easy to get the number of the currently running child
......................................................................

Make it easy to get the number of the currently running child

Change-Id: I2071f04b6f01e640c850c6470cfa9f2f48f62eac
---
M includes/ForkController.php
1 file changed, 12 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/43/106443/1

diff --git a/includes/ForkController.php b/includes/ForkController.php
index 2d5aa4b..0582230 100644
--- a/includes/ForkController.php
+++ b/includes/ForkController.php
@@ -30,7 +30,7 @@
  * @ingroup Maintenance
  */
 class ForkController {
-       protected $children = array();
+       protected $children = array(), $childNumber = 0;
        protected $termReceived = false;
        protected $flags = 0, $procsToStart = 0;
 
@@ -137,6 +137,16 @@
                return 'done';
        }
 
+       /**
+        * Get the number of the child currently running. Note, this
+        * is not the pid, but rather which of the total number of children
+        * we are
+        * @return int
+        */
+       public function getChildNumber() {
+               return $this->childNumber;
+       }
+
        protected function prepareEnvironment() {
                global $wgMemc;
                // Don't share DB, storage, or memcached connections
@@ -166,6 +176,7 @@
 
                        if ( !$pid ) {
                                $this->initChild();
+                               $this->childNumber = $i;
                                return 'child';
                        } else {
                                // This is the parent process

-- 
To view, visit https://gerrit.wikimedia.org/r/106443
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2071f04b6f01e640c850c6470cfa9f2f48f62eac
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Chad <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to