1 from django
.apps
import AppConfig
2 from mygpo
.pubsub
.signals
import subscription_updated
6 logger
= logging
.getLogger(__name__
)
9 def update_podcast(sender
, **kwargs
):
10 """update podcast in background when receiving pubsub-notification"""
11 from mygpo
.data
.tasks
import update_podcasts
13 logger
.info('updating podcast for "%s" after pubsub notification', sender
)
14 update_podcasts
.delay([sender
])
17 class DataAppConfig(AppConfig
):
21 subscription_updated
.connect(
22 update_podcast
, dispatch_uid
="update_podcast-pubsub"