Aaron Schulz has submitted this change and it was merged.

Change subject: Deal with PHP bug 63411 and tweaked sleep waits
......................................................................


Deal with PHP bug 63411 and tweaked sleep waits

Change-Id: Idf7a949a181aca52662ecce84e9e9256b8151aa8
---
M php-cloudfiles-wmf/cloudfiles_http.php
1 file changed, 8 insertions(+), 16 deletions(-)

Approvals:
  Aaron Schulz: Verified
  GWicke: Looks good to me, approved



diff --git a/php-cloudfiles-wmf/cloudfiles_http.php 
b/php-cloudfiles-wmf/cloudfiles_http.php
index cb24d83..e6e3c9d 100644
--- a/php-cloudfiles-wmf/cloudfiles_http.php
+++ b/php-cloudfiles-wmf/cloudfiles_http.php
@@ -1692,25 +1692,17 @@
                        }
                        // Execute the cURL handles concurrently...
                        $active = null; // handles still being processed
-                       if ( substr( php_uname(), 0, 7 ) == 'Windows' ) {
-                               do { // avoid curl_multi_select() per PHP bugs 
61141 and 61240
-                                       $mrc = curl_multi_exec( $multiHandle, 
$active );
-                                       if ( $mrc != CURLM_CALL_MULTI_PERFORM ) 
{
-                                               usleep( 100 ); // .1ms
-                                       }
-                               } while ( $mrc == CURLM_CALL_MULTI_PERFORM || ( 
$active && $mrc == CURLM_OK ) );
-                       } else {
-                               do { // start all the requests...
+                       do {
+                               // Do any available work...
+                               do {
                                        $mrc = curl_multi_exec( $multiHandle, 
$active );
                                } while ( $mrc == CURLM_CALL_MULTI_PERFORM );
-                               while ( $active && $mrc == CURLM_OK ) {
-                                       if ( curl_multi_select( $multiHandle, 
10 ) != -1 ) {
-                                               do { // keep working on this 
request...
-                                                       $mrc = curl_multi_exec( 
$multiHandle, $active );
-                                               } while ( $mrc == 
CURLM_CALL_MULTI_PERFORM );
-                                       }
+                               // Wait (if possible) for available work...
+                               if ( curl_multi_select( $multiHandle, 10 ) == 
-1 ) {
+                                       // PHP bug 63411; 
http://curl.haxx.se/libcurl/c/curl_multi_fdset.html
+                                       usleep( 5000 ); // 5ms
                                }
-                       }
+                       } while ( $active > 0 && $mrc == CURLM_OK );
                        // Remove all of the added cURL handles and check for 
errors...
                        foreach ( $this->requests as $request ) {
                                $handle = $request->getStepHandle( $stage );

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Idf7a949a181aca52662ecce84e9e9256b8151aa8
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/SwiftCloudFiles
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz <asch...@wikimedia.org>
Gerrit-Reviewer: Aaron Schulz <asch...@wikimedia.org>
Gerrit-Reviewer: GWicke <gwi...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to