mirror of
https://github.com/viq/NewsBlur.git
synced 2025-09-18 21:43:31 +00:00
Only checking raw parsed hub address 1 in 10 times.
This commit is contained in:
parent
f39c31e79b
commit
80088efb9c
1 changed files with 5 additions and 4 deletions
|
@ -1,12 +1,13 @@
|
|||
# Adapted from djpubsubhubbub. See License: http://git.participatoryculture.org/djpubsubhubbub/tree/LICENSE
|
||||
|
||||
import feedparser
|
||||
import random
|
||||
|
||||
from django.http import HttpResponse, Http404
|
||||
from django.shortcuts import get_object_or_404
|
||||
|
||||
from apps.push.models import PushSubscription
|
||||
from apps.push.signals import verified, updated
|
||||
from apps.push.signals import verified
|
||||
|
||||
def push_callback(request, push_id):
|
||||
if request.method == 'GET':
|
||||
|
@ -34,9 +35,9 @@ def push_callback(request, push_id):
|
|||
subscription = get_object_or_404(PushSubscription, pk=push_id)
|
||||
# XXX TODO: Optimize this by removing feedparser. It just needs to find out
|
||||
# the hub_url or topic has changed. ElementTree could do it.
|
||||
parsed = feedparser.parse(request.raw_post_data)
|
||||
subscription.check_urls_against_pushed_data(parsed)
|
||||
updated.send(sender=subscription, update=parsed)
|
||||
if random.random() < 0.1:
|
||||
parsed = feedparser.parse(request.raw_post_data)
|
||||
subscription.check_urls_against_pushed_data(parsed)
|
||||
|
||||
# Don't give fat ping, just fetch.
|
||||
# subscription.feed.queue_pushed_feed_xml(request.raw_post_data)
|
||||
|
|
Loading…
Add table
Reference in a new issue