From 6f65ab9a22881c73ce9f7b6b7cf54445e80fdb55 Mon Sep 17 00:00:00 2001 From: Erik Bernhardson Date: Tue, 25 Mar 2014 15:31:56 -0700 Subject: [PATCH] Reduce connect timeout in MediaWiki::triggerJobs The fifth parameter to fsockopen is the number of seconds to wait before declaring the connection a failure. When not provided it defaults to the php ini value of 'default_socket_timeout' which is 60s. Under no circumstances should we wait 60s to connect to ourselves, 100ms seems like a reasonable timeout since its explicitly connecting to itself, but the exact timeout could be slightly longer. Change-Id: I18d328274ddf1e0848fce40ebf39e0466b5c4d5d --- includes/Wiki.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/includes/Wiki.php b/includes/Wiki.php index 4bf8fd3a59..6cf718c5bc 100644 --- a/includes/Wiki.php +++ b/includes/Wiki.php @@ -655,7 +655,10 @@ class MediaWiki { $info['host'], isset( $info['port'] ) ? $info['port'] : 80, $errno, - $errstr + $errstr, + // If it takes more than 100ms to connect to ourselves there + // is a problem elsewhere. + 0.1 ); wfRestoreWarnings(); if ( !$sock ) { -- 2.20.1