Add enhanced error handling for 'Remote end closed connection' errors in RSS feed parsing
This commit is contained in:
parent
e975350701
commit
e23b4c2ac9
@ -102,8 +102,18 @@ def mine_all_articles(rss_feed_sources, limit=None):
|
|||||||
logger.error(f"Timeout parsing RSS feed: {site} Error: {str(e)}")
|
logger.error(f"Timeout parsing RSS feed: {site} Error: {str(e)}")
|
||||||
return []
|
return []
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Error parsing RSS feed: {site} Error: {str(e)}")
|
error_str = str(e).lower()
|
||||||
return []
|
# Handle specific network connection issues
|
||||||
|
if "remote end closed connection" in error_str or "connection closed" in error_str:
|
||||||
|
logger.warning(f"Network connection closed by remote end for feed: {site} - {str(e)}")
|
||||||
|
logger.info(f"Skipping problematic feed: {site}")
|
||||||
|
return []
|
||||||
|
elif "timeout" in error_str:
|
||||||
|
logger.error(f"Timeout parsing RSS feed: {site} Error: {str(e)}")
|
||||||
|
return []
|
||||||
|
else:
|
||||||
|
logger.error(f"Error parsing RSS feed: {site} Error: {str(e)}")
|
||||||
|
return []
|
||||||
|
|
||||||
# Use ThreadPoolExecutor for parallel RSS feed parsing
|
# Use ThreadPoolExecutor for parallel RSS feed parsing
|
||||||
from concurrent.futures import ThreadPoolExecutor, as_completed
|
from concurrent.futures import ThreadPoolExecutor, as_completed
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user