Permalink
Browse files

Added a favicon-specific queue

  • Loading branch information...
brutasse committed Mar 18, 2013
1 parent 1d03780 commit 19c089e355897fdb4f5cf0a16df613d1541e437f
Showing with 10 additions and 4 deletions.
  1. +1 −1 README.rst
  2. +9 −3 feedhq/feeds/tasks.py
View
@@ -121,7 +121,7 @@ Note that additionally to the web server, you need to run one or more
consumers for the task queue. This is done with the ``rqworker`` management
command::
- django-admin.py rqworker high default low
+ django-admin.py rqworker favicons high default low
The arguments are queue names. FeedHQ only uses the ``high`` and ``default``
queues but this is the pattern advertised by RQ and the low queue may be used
View
@@ -1,8 +1,9 @@
import logging
-from rq.timeouts import JobTimeoutException
+from django.db import DatabaseError
from django_push.subscriber.models import Subscription
+from rq.timeouts import JobTimeoutException
from ..tasks import raven, enqueue
@@ -37,10 +38,15 @@ def update_unique_feed(feed_url):
defaults={'subscribers': 1},
)
if created:
- enqueue(update_favicon, args=[feed_url], queue='high')
+ enqueue(update_favicon, args=[feed_url], queue='favicons')
else:
feed.subscribers = Feed.objects.filter(url=feed_url).count()
- feed.save(update_fields=['subscribers'])
+ try:
+ feed.save(update_fields=['subscribers'])
+ except DatabaseError as e:
+ # Possible concurrent update with a different UniqueFeed
+ if "Save with update_fields did not affect any rows" not in str(e):
+ raise
@raven

0 comments on commit 19c089e

Please sign in to comment.