mirror of
https://github.com/inventree/InvenTree.git
synced 2026-07-09 16:41:25 +00:00
Fix news feed task timeout (#6250)
This commit is contained in:
@@ -10,6 +10,7 @@ from django.db.utils import IntegrityError, OperationalError
|
||||
from django.utils import timezone
|
||||
|
||||
import feedparser
|
||||
import requests
|
||||
|
||||
from InvenTree.helpers_model import getModelsWithMixin
|
||||
from InvenTree.models import InvenTreeNotesMixin
|
||||
@@ -47,11 +48,16 @@ def update_news_feed():
|
||||
logger.info("Could not perform 'update_news_feed' - App registry not ready")
|
||||
return
|
||||
|
||||
# News feed isn't defined, no need to continue
|
||||
if not settings.INVENTREE_NEWS_URL or type(settings.INVENTREE_NEWS_URL) != str:
|
||||
return
|
||||
|
||||
# Fetch and parse feed
|
||||
try:
|
||||
d = feedparser.parse(settings.INVENTREE_NEWS_URL)
|
||||
except Exception as entry: # pragma: no cover
|
||||
logger.warning('update_news_feed: Error parsing the newsfeed', entry)
|
||||
feed = requests.get(settings.INVENTREE_NEWS_URL)
|
||||
d = feedparser.parse(feed.content)
|
||||
except Exception: # pragma: no cover
|
||||
logger.warning('update_news_feed: Error parsing the newsfeed')
|
||||
return
|
||||
|
||||
# Get a reference list
|
||||
|
||||
Reference in New Issue
Block a user