Is there a way in Web.py to detect and handle connection being closed by user while the request is processing?
I tried setting unloadhook handler, but it doesn't get called in this case. It's only called after the request was successfully completed:
class handler:
def __init__(self):
pass
def GET(self):
try:
while(True):
pass
except Exception, e:
logger.debug(e)
def unload():
logger.debug('unloaded')
try:
app = web.application(urls, globals())
app.add_processor(web.unloadhook(unload))
application = app.wsgifunc()
except Exception, e:
logger.debug(e)
I open the app in a browser and when it starts spinning in the while loop I break the request, but no exception is thrown.