1 from mygpo
.podcasts
.models
import Podcast
2 from mygpo
.subscriptions
.models
import Subscription
3 from mygpo
.celery
import celery
6 @celery.task(max_retries
=5)
7 def update_podcast_subscribers(podcast_id
):
8 """ Updates the subscriber count of a podcast """
11 podcast
= Podcast
.objects
.get(id=podcast_id
)
13 # calculate current number of subscribers
14 podcast
.subscribers
= Subscription
.objects
.filter(podcast
=podcast
)\
20 #TODO: which exceptions?
21 except Exception as ex
:
22 raise update_podcast_subscribers
.retry(exc
=ex
)