r88353 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r88352‎ | r88353 | r88354 >
Date:21:35, 17 May 2011
Author:rainman
Status:deferred
Tags:
Comment:
Add connection timeouts since there seems to be a broken WMF server that never end the connection
Modified paths:
  • /trunk/lucene-search-2/src/org/wikimedia/lsearch/oai/OAIHarvester.java (modified) (history)

Diff [purge]

Index: trunk/lucene-search-2/src/org/wikimedia/lsearch/oai/OAIHarvester.java
@@ -6,6 +6,7 @@
77 import java.net.Authenticator;
88 import java.net.MalformedURLException;
99 import java.net.URL;
 10+import java.net.URLConnection;
1011 import java.util.ArrayList;
1112
1213 import org.apache.log4j.Logger;
@@ -65,7 +66,11 @@
6667 for(int tryNum = 1; tryNum <= this.retries; tryNum++){
6768 try{
6869 collector = new IndexUpdatesCollector(iid);
69 - InputStream in = new BufferedInputStream(url.openStream());
 70+ URLConnection urlConn = url.openConnection();
 71+ // set some timeouts
 72+ urlConn.setReadTimeout(60 * 1000); // 60 seconds
 73+ urlConn.setConnectTimeout(60 * 1000); // 60 seconds
 74+ InputStream in = new BufferedInputStream(urlConn.getInputStream());
7075 parser = new OAIParser(in,collector);
7176 parser.parse();
7277 resumptionToken = parser.getResumptionToken();

Status & tagging log