Skip to content

Commit

Permalink
logging modified, add setting
Browse files Browse the repository at this point in the history
  • Loading branch information
yinan-c committed Jul 16, 2024
1 parent 57e8ec8 commit 6333191
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 3 additions & 2 deletions FeedManager/management/commands/update_feeds.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def fetch_feed(url: str, last_modified: datetime):
# ! Why is it taking so long to show not_modified? 8 seconds
# Maybe it's because of the User-Agent or the If-Modified-Since header?
#print(time.time())
return {'feed': None, 'status': 'not_modified'}
return {'feed': None, 'status': 'not_modified', 'last_modified': response.headers.get('Last-Modified')}
else:
logger.error(f'Failed to fetch feed {url}: {response.status_code}')
return {'feed': None, 'status': 'failed'}
Expand Down Expand Up @@ -93,6 +93,7 @@ def update_feed(self, feed):
original_feed.valid = True
original_feed.save()
logger.info(f' Feed {original_feed.url} not modified')
logger.info(f' Feed {original_feed.url} modified time is {feed_data["last_modified"]} and the current feed modified time is {current_modified}')
continue
elif feed_data['status'] == 'failed':
logger.error(f' Failed to fetch feed {original_feed.url}')
Expand All @@ -113,7 +114,7 @@ def process_entry(self, entry, feed, original_feed):
# 先检查 filter 再检查数据库
if passes_filters(entry, feed, 'feed_filter'):
existing_article = Article.objects.filter(link=clean_url(entry.link), original_feed=original_feed).first()
logger.info(f' Already in db: {entry.title}' if existing_article else f' Processing new article: {entry.title}')
logger.debug(f' Already in db: {entry.title}' if existing_article else f' Processing new article: {entry.title}')
if not existing_article:
# 如果不存在,则创建新文章
article = Article(
Expand Down
4 changes: 3 additions & 1 deletion rssbrew/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,4 +227,6 @@
result_store=True,
events=True,
store_none=False,
)
)

DATA_UPLOAD_MAX_NUMBER_FIELDS = 10240

0 comments on commit 6333191

Please sign in to comment.