Skip to content

Commit b539e28

Browse files
Backport: Timeout for querying for Uniprot features (#933)
1 parent e0a8673 commit b539e28

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

protein/api-src/org/labkey/api/protein/fasta/FastaProtein.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public FastaProtein(String header, byte[] bytes)
8484
if (header.startsWith("gi|"))
8585
{
8686
firstAliasIndex = header.indexOf(" gi|", 2) + 1;
87-
if (firstAliasIndex < 0 || firstAliasIndex > 30)
87+
if (firstAliasIndex > 30)
8888
firstAliasIndex = 0;
8989
}
9090

protein/src/org/labkey/protein/ProteinServiceImpl.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,8 @@ public List<ProteinFeature> load(@NotNull String accession, @Nullable Object arg
300300
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
301301
con.setRequestProperty("Accept", "application/xml");
302302
con.setRequestMethod("GET");
303+
con.setConnectTimeout(20_000);
304+
con.setReadTimeout(20_000);
303305
int responseCode = con.getResponseCode();
304306
if (responseCode == HttpURLConnection.HTTP_OK)
305307
{ // success
@@ -370,7 +372,7 @@ else if (location.getChildNodes().getLength() == 2)
370372
{
371373
if (responseCode != 404)
372374
{
373-
LOG.error("HTTP GET failed to " + url + " with error code " + responseCode);
375+
LOG.warn("HTTP GET failed to " + url + " with error code " + responseCode);
374376
}
375377
else
376378
{

0 commit comments

Comments
 (0)