Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fixing timeout error on PUSH. Also fixing requests error on page impo…
…rting.
  • Loading branch information
samuelclay committed Mar 11, 2015
1 parent 0b270fe commit 02c91bb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
13 changes: 9 additions & 4 deletions apps/push/models.py
Expand Up @@ -12,7 +12,7 @@
from apps.push import signals
from apps.rss_feeds.models import Feed
from utils import log as logging
from utils.feed_functions import timelimit
from utils.feed_functions import timelimit, TimeoutError

DEFAULT_LEASE_SECONDS = (10 * 24 * 60 * 60) # 10 days

Expand Down Expand Up @@ -155,9 +155,14 @@ def check_urls_against_pushed_data(self, parsed):
unicode(self.feed)[:30], hub_url, self_url))
expiration_time = self.lease_expires - datetime.now()
seconds = expiration_time.days*86400 + expiration_time.seconds
PushSubscription.objects.subscribe(
self_url, feed=self.feed, hub=hub_url,
lease_seconds=seconds)
try:
PushSubscription.objects.subscribe(
self_url, feed=self.feed, hub=hub_url,
lease_seconds=seconds)
except TimeoutError, e:
logging.debug(u' ---> [%-30s] ~FR~BKTimed out updating PuSH hub/topic: %s / %s' % (
unicode(self.feed)[:30], hub_url, self_url))


def __unicode__(self):
if self.verified:
Expand Down
2 changes: 1 addition & 1 deletion apps/rss_feeds/page_importer.py
Expand Up @@ -173,7 +173,7 @@ def _fetch_story(self):
response.connection.close()
except requests.exceptions.TooManyRedirects:
response = requests.get(story_permalink)
except (AttributeError, SocketError, OpenSSLError, PyAsn1Error), e:
except (AttributeError, SocketError, OpenSSLError, PyAsn1Error, requests.exceptions.ConnectionError), e:
logging.debug(' ***> [%-30s] Original story fetch failed using requests: %s' % (self.feed, e))
return
try:
Expand Down

0 comments on commit 02c91bb

Please sign in to comment.