mirror of
https://github.com/moparisthebest/SickRage
synced 2025-01-07 03:48:02 -05:00
Fixed issues with network timezone downloads crashing on a empty return.
Changed version checker url and moved code to Home class. Fixed WebUI issues caused by calling redirect method. Fixed update checking issues, added no cache header.
This commit is contained in:
parent
979bf70f5c
commit
0b403a419c
@ -68,10 +68,7 @@ class SearchQueue(generic_queue.GenericQueue):
|
|||||||
for cur_item in self.queue:
|
for cur_item in self.queue:
|
||||||
if isinstance(cur_item, (ManualSearchQueueItem, FailedQueueItem)) and str(cur_item.show.indexerid) == show:
|
if isinstance(cur_item, (ManualSearchQueueItem, FailedQueueItem)) and str(cur_item.show.indexerid) == show:
|
||||||
ep_obj_list.append(cur_item)
|
ep_obj_list.append(cur_item)
|
||||||
|
return ep_obj_list
|
||||||
if ep_obj_list:
|
|
||||||
return ep_obj_list
|
|
||||||
return False
|
|
||||||
|
|
||||||
def pause_backlog(self):
|
def pause_backlog(self):
|
||||||
self.min_priority = generic_queue.QueuePriorities.HIGH
|
self.min_priority = generic_queue.QueuePriorities.HIGH
|
||||||
|
@ -99,9 +99,6 @@ class CheckVersion():
|
|||||||
if not sickbeard.AUTO_UPDATE:
|
if not sickbeard.AUTO_UPDATE:
|
||||||
logger.log(u"Checking for updates using " + self.install_type.upper())
|
logger.log(u"Checking for updates using " + self.install_type.upper())
|
||||||
|
|
||||||
if force:
|
|
||||||
ui.notifications.message("Checking for updates using " + self.install_type.upper())
|
|
||||||
|
|
||||||
if not self.updater.need_update():
|
if not self.updater.need_update():
|
||||||
sickbeard.NEWEST_VERSION_STRING = None
|
sickbeard.NEWEST_VERSION_STRING = None
|
||||||
|
|
||||||
|
@ -85,25 +85,6 @@ from bug_tracker import BugTracker
|
|||||||
|
|
||||||
route_locks = {}
|
route_locks = {}
|
||||||
|
|
||||||
class AsyncRunner(object):
|
|
||||||
@run_on_executor
|
|
||||||
def call(self, function, callback=None, **kwargs):
|
|
||||||
try:
|
|
||||||
result = function(**kwargs)
|
|
||||||
if callback:
|
|
||||||
callback(result)
|
|
||||||
return result
|
|
||||||
except:
|
|
||||||
logger.log('Failed doing webui callback: %s' % (traceback.format_exc()), logger.ERROR)
|
|
||||||
|
|
||||||
class ThreadedRunner(AsyncRunner):
|
|
||||||
def __init__(self, executor=ThreadPoolExecutor, max_workers=10):
|
|
||||||
self.io_loop = IOLoop.current()
|
|
||||||
self.executor = executor(max_workers)
|
|
||||||
|
|
||||||
def shutdown(self, wait=True):
|
|
||||||
self.executor.shutdown(wait)
|
|
||||||
|
|
||||||
class PageTemplate(Template):
|
class PageTemplate(Template):
|
||||||
def __init__(self, rh, *args, **kwargs):
|
def __init__(self, rh, *args, **kwargs):
|
||||||
kwargs['file'] = os.path.join(sickbeard.PROG_DIR, "gui/" + sickbeard.GUI_NAME + "/interfaces/default/", kwargs['file'])
|
kwargs['file'] = os.path.join(sickbeard.PROG_DIR, "gui/" + sickbeard.GUI_NAME + "/interfaces/default/", kwargs['file'])
|
||||||
@ -197,7 +178,8 @@ class BaseHandler(RequestHandler):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
class WebHandler(BaseHandler):
|
class WebHandler(BaseHandler):
|
||||||
tr = ThreadedRunner(max_workers=50)
|
io_loop = IOLoop.current()
|
||||||
|
executor = ThreadPoolExecutor(50)
|
||||||
|
|
||||||
@coroutine
|
@coroutine
|
||||||
@asynchronous
|
@asynchronous
|
||||||
@ -223,15 +205,22 @@ class WebHandler(BaseHandler):
|
|||||||
params[arg] = value[0]
|
params[arg] = value[0]
|
||||||
|
|
||||||
# process request async
|
# process request async
|
||||||
self.tr.call(method, callback=self.finished, **params)
|
self.async_call(method, callback=self.async_done, **params)
|
||||||
except:
|
except:
|
||||||
logger.log('Failed doing webui request "%s": %s' % (route, traceback.format_exc()), logger.ERROR)
|
logger.log('Failed doing webui request "%s": %s' % (route, traceback.format_exc()), logger.ERROR)
|
||||||
raise HTTPError(404)
|
raise HTTPError(404)
|
||||||
|
|
||||||
def post(self, route, *args, **kwargs):
|
@run_on_executor
|
||||||
super(WebHandler, self).get(route, *args, **kwargs)
|
def async_call(self, function, callback=None, **kwargs):
|
||||||
|
try:
|
||||||
|
result = function(**kwargs)
|
||||||
|
if callback:
|
||||||
|
callback(result)
|
||||||
|
return result
|
||||||
|
except:
|
||||||
|
logger.log('Failed doing webui callback: %s' % (traceback.format_exc()), logger.ERROR)
|
||||||
|
|
||||||
def finished(self, results):
|
def async_done(self, results):
|
||||||
try:
|
try:
|
||||||
if results is not None:
|
if results is not None:
|
||||||
try:
|
try:
|
||||||
@ -287,6 +276,9 @@ class WebHandler(BaseHandler):
|
|||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
# post uses get method
|
||||||
|
post = get
|
||||||
|
|
||||||
class LoginHandler(BaseHandler):
|
class LoginHandler(BaseHandler):
|
||||||
def get(self, *args, **kwargs):
|
def get(self, *args, **kwargs):
|
||||||
|
|
||||||
@ -984,7 +976,6 @@ class Home(WebRoot):
|
|||||||
return "Error sending Pushbullet notification"
|
return "Error sending Pushbullet notification"
|
||||||
|
|
||||||
def shutdown(self, pid=None):
|
def shutdown(self, pid=None):
|
||||||
|
|
||||||
if str(pid) != str(sickbeard.PID):
|
if str(pid) != str(sickbeard.PID):
|
||||||
self.redirect("/home/")
|
self.redirect("/home/")
|
||||||
return
|
return
|
||||||
@ -1013,6 +1004,7 @@ class Home(WebRoot):
|
|||||||
if str(pid) != str(sickbeard.PID):
|
if str(pid) != str(sickbeard.PID):
|
||||||
self.redirect('/home/')
|
self.redirect('/home/')
|
||||||
|
|
||||||
|
self.set_header('Cache-Control', 'max-age=0,no-cache,no-store')
|
||||||
sickbeard.versionCheckScheduler.action.check_for_new_version(force=True)
|
sickbeard.versionCheckScheduler.action.check_for_new_version(force=True)
|
||||||
|
|
||||||
self.redirect('/home/')
|
self.redirect('/home/')
|
||||||
|
Loading…
Reference in New Issue
Block a user