From 7ec3bbe414abe58072fda63f4f9c801f77b292e1 Mon Sep 17 00:00:00 2001 From: Devendra Date: Sun, 6 Oct 2013 14:39:59 +0530 Subject: changing timeout from 200 to 310 s, changed exception handling to not silently eat execeptions in callback --- python-tornado/unassembled/Platform.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'python-tornado/unassembled') diff --git a/python-tornado/unassembled/Platform.py b/python-tornado/unassembled/Platform.py index 618927e..4df04b3 100644 --- a/python-tornado/unassembled/Platform.py +++ b/python-tornado/unassembled/Platform.py @@ -9,6 +9,7 @@ except ImportError: import hmac import tornado.ioloop +from tornado.stack_context import ExceptionStackContext from PubnubCrypto import PubnubCrypto ioloop = tornado.ioloop.IOLoop.instance() @@ -47,9 +48,17 @@ class Pubnub(PubnubCoreAsync): url = self.getUrl(request) ## Send Request Expecting JSON Response #print self.headers - request = tornado.httpclient.HTTPRequest( url, 'GET', self.headers, connect_timeout=310, request_timeout=310 ) + + request = tornado.httpclient.HTTPRequest( url, 'GET', self.headers, connect_timeout=10, request_timeout=310 ) + def responseCallback(response): - callback(eval(response._get_body())) + def handle_exc(*args): + return True + if response.error is not None: + with ExceptionStackContext(handle_exc): + response.rethrow() + else: + callback(eval(response._get_body())) self.http.fetch( request, -- cgit v1.2.3