You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by br...@apache.org on 2021/03/02 17:30:43 UTC
[allura] branch db/blog_rss_timeouts created (now 6b9f07b)
This is an automated email from the ASF dual-hosted git repository.
brondsem pushed a change to branch db/blog_rss_timeouts
in repository https://gitbox.apache.org/repos/asf/allura.git.
at 6b9f07b Put a general network socket timeout around RSS feed fetching (default otherwise is no timeout)
This branch includes the following new commits:
new 6b9f07b Put a general network socket timeout around RSS feed fetching (default otherwise is no timeout)
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
[allura] 01/01: Put a general network socket timeout around RSS
feed fetching (default otherwise is no timeout)
Posted by br...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
brondsem pushed a commit to branch db/blog_rss_timeouts
in repository https://gitbox.apache.org/repos/asf/allura.git
commit 6b9f07b94f9531f90a791f857ee4f3951a180f79
Author: Dave Brondsema <db...@slashdotmedia.com>
AuthorDate: Tue Mar 2 12:25:31 2021 -0500
Put a general network socket timeout around RSS feed fetching (default otherwise is no timeout)
---
ForgeBlog/forgeblog/command/rssfeeds.py | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/ForgeBlog/forgeblog/command/rssfeeds.py b/ForgeBlog/forgeblog/command/rssfeeds.py
index cc64d8a..e35a4cd 100644
--- a/ForgeBlog/forgeblog/command/rssfeeds.py
+++ b/ForgeBlog/forgeblog/command/rssfeeds.py
@@ -35,6 +35,7 @@ from forgeblog.main import ForgeBlogApp
from allura.lib import exceptions
from allura.lib.helpers import exceptionless
from allura.lib.helpers import plain2markdown
+from allura.lib.utils import socket_default_timeout
# Everything in this file depends on html2text,
# so import attempt is placed in global scope.
@@ -75,10 +76,11 @@ class RssFeedsCommand(base.BlogCommand):
user = M.User.query.get(username=self.options.username)
c.user = user
- self.prepare_feeds()
- for appid in self.feed_dict:
- for feed_url in self.feed_dict[appid]:
- self.process_feed(appid, feed_url)
+ with socket_default_timeout(20):
+ self.prepare_feeds()
+ for appid in self.feed_dict:
+ for feed_url in self.feed_dict[appid]:
+ self.process_feed(appid, feed_url)
def prepare_feeds(self):
feed_dict = {}
@@ -105,10 +107,10 @@ class RssFeedsCommand(base.BlogCommand):
app = ForgeBlogApp(c.project, appconf)
c.app = app
- allura_base.log.info("Get feed: %s" % feed_url)
+ allura_base.log.info("Getting {} feed {}".format(app.url, feed_url))
f = feedparser.parse(feed_url)
if f.bozo:
- allura_base.log.exception("%s: %s" % (feed_url, f.bozo_exception))
+ allura_base.log.warn("{} feed {} errored: {}".format(app.url, feed_url, f.bozo_exception))
return
for e in f.entries:
self.process_entry(e, appid)