From 6e17bf4e40514e5fa34aafdccd4ada94c07614bc Mon Sep 17 00:00:00 2001 From: Daniel Blankenberg Date: Mon, 2 Mar 2015 11:34:55 -0500 Subject: [PATCH] Add a 10 second timeout to loading data URLs for Tool Data Tables. --- lib/galaxy/tools/data/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/galaxy/tools/data/__init__.py b/lib/galaxy/tools/data/__init__.py index 59c729c9bf93..c90b188027c9 100644 --- a/lib/galaxy/tools/data/__init__.py +++ b/lib/galaxy/tools/data/__init__.py @@ -263,7 +263,7 @@ def __init__( self, config_element, tool_data_path, from_shed_config=False, file self.data = [] self.configure_and_load( config_element, tool_data_path, from_shed_config) - def configure_and_load( self, config_element, tool_data_path, from_shed_config=False): + def configure_and_load( self, config_element, tool_data_path, from_shed_config=False, url_timeout=10 ): """ Configure and load table from an XML element. """ @@ -289,7 +289,7 @@ def configure_and_load( self, config_element, tool_data_path, from_shed_config=F if filename: tmp_file = NamedTemporaryFile( prefix='TTDT_URL_%s-' % self.name ) try: - tmp_file.write( urlopen( filename ).read() ) + tmp_file.write( urlopen( filename, timeout=url_timeout ).read() ) except Exception, e: log.error( 'Error loading Data Table URL "%s": %s', filename, e ) continue