From 45298abb98c76dc234bb7b2cc29ae06e29c438d7 Mon Sep 17 00:00:00 2001 From: Danielle McLean Date: Mon, 6 Nov 2017 11:46:43 +1100 Subject: [PATCH] Actually queue up the ping_hub operation on the queue by using its delay() method --- entries/jobs.py | 9 ++++++--- micropub/views.py | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/entries/jobs.py b/entries/jobs.py index 0f92be0..c2c7d46 100644 --- a/entries/jobs.py +++ b/entries/jobs.py @@ -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), + }) diff --git a/micropub/views.py b/micropub/views.py index 5105228..868e003 100644 --- a/micropub/views.py +++ b/micropub/views.py @@ -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