Actually queue up the ping_hub operation on the queue by using its delay() method

This commit is contained in:
Danielle McLean 2017-11-06 11:46:43 +11:00
parent e853e22362
commit 45298abb98
Signed by untrusted user: 00dani
GPG key ID: 5A5D2D1AFF12EEC5
2 changed files with 7 additions and 4 deletions

View file

@ -1,8 +1,11 @@
from django_push import publisher
import requests
from django.conf import settings
from django_rq import job
@job
def ping_hub(*urls):
for url in urls:
publisher.ping_hub(url)
requests.post(settings.PUSH_HUB, data={
'hub.mode': 'publish',
'hub.url': ','.join(urls),
})

View file

@ -43,7 +43,7 @@ def micropub(request):
reverse('entries:atom'),
reverse('entries:rss'),
))
ping_hub(perma, *others)
ping_hub.delay(perma, *others)
res = HttpResponse(status=201)
res['Location'] = perma