Permalink
Browse files

import_feed is also now a task, this way rss feeds and similar reques…

…ts can be made async.
  • Loading branch information...
1 parent dde92e3 commit c3d98eac91394ec7bd8f1259e11c375377871ef1 @davbo davbo committed Mar 23, 2012
Showing with 3 additions and 8 deletions.
  1. +3 −8 molly/apps/feeds/providers/rss.py
@@ -34,14 +34,11 @@ def import_data(self, **metadata):
from molly.apps.feeds.models import Feed
for feed in Feed.objects.filter(provider=self.class_path):
- logger.info("Importing %s\n" % feed.title)
- try:
- self.import_feed(feed)
- except Exception, e:
- logger.warn("Error importing feed %r" % feed.title,
- exc_info=True, extra={'url': feed.rss_url})
+ logger.debug("Importing: %s - %s" % (feed.title, feed.rss_url))
+ self.import_feed.apply_async(args=(feed,))
return metadata
+ @task()
def import_feed(self, feed):
from molly.apps.feeds.models import Item
@@ -93,5 +90,3 @@ def import_feed(self, feed):
for item in Item.objects.filter(feed=feed):
if item not in items:
item.delete()
-
- return items

0 comments on commit c3d98ea

Please sign in to comment.