1
0
mirror of https://github.com/moparisthebest/SickRage synced 2024-11-17 14:55:07 -05:00

Tornado WebUI now asynchronous, huge performance increase.

This commit is contained in:
echel0n 2014-07-27 05:51:22 -07:00
parent f2a1331110
commit f67fa660be

View File

@ -81,9 +81,7 @@ except ImportError:
from lib import adba from lib import adba
from Cheetah.Template import Template from Cheetah.Template import Template
from tornado.web import RequestHandler, HTTPError, asynchronous
from tornado.web import RequestHandler, HTTPError
def authenticated(handler_class): def authenticated(handler_class):
def wrap_execute(handler_execute): def wrap_execute(handler_execute):
@ -190,7 +188,6 @@ class MainHandler(RequestHandler):
trace_info, request_info)) trace_info, request_info))
def _dispatch(self): def _dispatch(self):
path = self.request.uri.replace(sickbeard.WEB_ROOT, '').split('?')[0] path = self.request.uri.replace(sickbeard.WEB_ROOT, '').split('?')[0]
method = path.strip('/').split('/')[-1] method = path.strip('/').split('/')[-1]
@ -236,12 +233,14 @@ class MainHandler(RequestHandler):
raise HTTPError(404) raise HTTPError(404)
@asynchronous
def get(self, *args, **kwargs): def get(self, *args, **kwargs):
try: try:
self.finish(self._dispatch()) self.finish(self._dispatch())
except HTTPRedirect, e: except HTTPRedirect, e:
self.redirect(e.url, e.permanent, e.status) self.redirect(e.url, e.permanent, e.status)
@asynchronous
def post(self, *args, **kwargs): def post(self, *args, **kwargs):
try: try:
self.finish(self._dispatch()) self.finish(self._dispatch())