@@ 4,3 4,4 @@ from django.dispatch import Signal
pre_subscribe = Signal(providing_args=['created'])
verified = Signal()
updated = Signal(providing_args=['update'])
+subscription_needs_update = Signal(providing_args=['hub_url', 'topic_url'])
@@ 8,7 8,7 @@ from django.views.decorators.csrf import
from django.utils.datastructures import MultiValueDictKeyError
from djpubsubhubbub.models import Subscription, DEFAULT_LEASE_SECONDS
-from djpubsubhubbub.signals import verified, updated
+from djpubsubhubbub.signals import verified, updated, subscription_needs_update
@csrf_exempt
@@ 85,14 85,10 @@ def callback(request, pk):
needs_update = True
if needs_update:
- expiration_time = subscription.lease_expires - datetime.now()
- seconds = (expiration_time.days * 86400) + \
- expiration_time.seconds
- Subscription.objects.do_action(
- self_url,
- hub_url,
- callback=request.build_absolute_uri(),
- lease_seconds=seconds,
+ subscription_needs_update.send(
+ sender=subscription,
+ hub_url=hub_url,
+ topic_url=self_url,
)
updated.send(sender=subscription, update=parsed)