We handle exceptions if PuSH fails
This commit is contained in:
parent
6d13314e99
commit
77b91efcc2
@ -21,6 +21,7 @@ from cgi import FieldStorage
|
|||||||
|
|
||||||
from celery import registry
|
from celery import registry
|
||||||
import urllib,urllib2
|
import urllib,urllib2
|
||||||
|
import logging
|
||||||
|
|
||||||
from werkzeug.utils import secure_filename
|
from werkzeug.utils import secure_filename
|
||||||
|
|
||||||
@ -138,8 +139,17 @@ def submit_start(request):
|
|||||||
"Content-type": "application/x-www-form-urlencoded",
|
"Content-type": "application/x-www-form-urlencoded",
|
||||||
"Connection": "close"}
|
"Connection": "close"}
|
||||||
for huburl in mg_globals.app_config["push_urls"]:
|
for huburl in mg_globals.app_config["push_urls"]:
|
||||||
hubrequest = urllib2.Request(huburl, hubdata,hubheaders)
|
hubrequest = urllib2.Request(huburl, hubdata, hubheaders)
|
||||||
|
try:
|
||||||
hubresponse = urllib2.urlopen(hubrequest)
|
hubresponse = urllib2.urlopen(hubrequest)
|
||||||
|
except urllib2.HTTPError as exc:
|
||||||
|
# This is not a big issue, the item will be fetched
|
||||||
|
# by the PuSH server next time we hit it
|
||||||
|
logging.getLogger(__name__).warning(
|
||||||
|
"push url %r gave error %r", huburl, exc.code)
|
||||||
|
except urllib2.URLError as exc:
|
||||||
|
logging.getLogger(__name__).warning(
|
||||||
|
"push url %r is unreachable %r", huburl, exc.reason)
|
||||||
|
|
||||||
add_message(request, SUCCESS, _('Woohoo! Submitted!'))
|
add_message(request, SUCCESS, _('Woohoo! Submitted!'))
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user