Wrapped the RSS parsing loop in a try-except block to prevent the backend from continuously crashing if there are encoding issues on the RSS titles

This commit is contained in:
Fabio Manganiello 2018-10-21 14:47:52 +02:00
parent 7adfb67c12
commit ae7cd120d2
1 changed files with 30 additions and 26 deletions

View File

@ -127,6 +127,7 @@ class RssUpdates(HttpRequest):
if not entry.published_parsed:
continue
try:
entry_timestamp = datetime.datetime(*entry.published_parsed[:6])
if latest_update is None \
@ -159,6 +160,9 @@ class RssUpdates(HttpRequest):
entries.append(e)
session.add(FeedEntry(**e))
if self.max_entries and len(entries) > self.max_entries: break
except Exception as e:
self.logger.warning('Exception encountered while parsing RSS ' +
'RSS feed {}: {}'.format(self.url, str(e)))
source_record.last_updated_at = parse_start_time
digest_filename = None