mirror of
https://github.com/inventree/InvenTree.git
synced 2025-07-02 11:40:58 +00:00
Improvements for docker / gunicorn (#4031)
* Additional options for gunicorn configuration file (in docker): Ref: https://pythonspeed.com/articles/gunicorn-in-docker/ * Catch potential error on startup * Tweak log message for docker * Wrap news feed update in try block
This commit is contained in:
@ -5,6 +5,7 @@ from datetime import datetime, timedelta
|
||||
|
||||
from django.conf import settings
|
||||
from django.core.exceptions import AppRegistryNotReady
|
||||
from django.db.utils import IntegrityError, OperationalError
|
||||
|
||||
import feedparser
|
||||
|
||||
@ -57,13 +58,17 @@ def update_news_feed():
|
||||
continue
|
||||
|
||||
# Create entry
|
||||
NewsFeedEntry.objects.create(
|
||||
feed_id=entry.id,
|
||||
title=entry.title,
|
||||
link=entry.link,
|
||||
published=entry.published,
|
||||
author=entry.author,
|
||||
summary=entry.summary,
|
||||
)
|
||||
try:
|
||||
NewsFeedEntry.objects.create(
|
||||
feed_id=entry.id,
|
||||
title=entry.title,
|
||||
link=entry.link,
|
||||
published=entry.published,
|
||||
author=entry.author,
|
||||
summary=entry.summary,
|
||||
)
|
||||
except (IntegrityError, OperationalError):
|
||||
# Sometimes errors-out on database start-up
|
||||
pass
|
||||
|
||||
logger.info('update_news_feed: Sync done')
|
||||
|
Reference in New Issue
Block a user