From 99c4faaa79d725b5e79316322e9da79e76559bcf Mon Sep 17 00:00:00 2001 From: Samuel Clay Date: Wed, 2 Feb 2022 15:44:39 -0500 Subject: [PATCH] Correcting story limit in widget. --- apps/reader/views.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/reader/views.py b/apps/reader/views.py index 53c414361..5ff0a710d 100644 --- a/apps/reader/views.py +++ b/apps/reader/views.py @@ -1459,7 +1459,7 @@ def load_river_stories__redis(request): story_hashes = [] unread_feed_story_hashes = [] - mstories = MStory.objects(story_hash__in=story_hashes).order_by(story_date_order) + mstories = MStory.objects(story_hash__in=story_hashes[:limit]).order_by(story_date_order) stories = Feed.format_stories(mstories) found_feed_ids = list(set([story['story_feed_id'] for story in stories])) @@ -1614,6 +1614,9 @@ def load_river_stories_widget(request): scontext.verify_mode = ssl.VerifyMode.CERT_NONE try: conn = urllib.request.urlopen(url, context=scontext, timeout=timeout) + except urllib.request.URLError: + url = url.replace('localhost', 'haproxy') + conn = urllib.request.urlopen(url, context=scontext, timeout=timeout) except socket.timeout: logging.user(request.user, '"%s" not fetched in %ss' % (url, (time.time() - start))) return None