mirror of
https://github.com/SickGear/SickGear.git
synced 2024-12-11 05:33:37 +00:00
Change logger clean up to prevent lock during restart under pythonw.
This commit is contained in:
parent
80cf6494e8
commit
411edd094e
5 changed files with 17 additions and 13 deletions
|
@ -247,6 +247,7 @@
|
|||
* Change torrent provider links for bts, et, rarbg, tpb
|
||||
* Change IPT uri used for sanity check
|
||||
* Change PiSexy auth check
|
||||
* Change logger clean up to prevent lock during restart under pythonw
|
||||
|
||||
|
||||
### 0.11.16 (2016-10-16 17:30:00 UTC)
|
||||
|
|
|
@ -71,7 +71,7 @@
|
|||
<!--
|
||||
var sbRoot = '$sbRoot', anonURL = '$sickbeard.ANON_REDIRECT', themeSpinner = '#echo ('', '-dark')['dark' == $sickbeard.THEME_NAME]#',
|
||||
top_image_html = '<img src="$sbRoot/images/top.gif" width="31" height="11" alt="Jump to top" />', topmenu = '$topmenu';
|
||||
\$.SickGear = {Root: '${sbRoot}'};
|
||||
\$.SickGear = {Root: '${sbRoot}', PID: '${sbPID}'};
|
||||
//-->
|
||||
</script>
|
||||
<script type="text/javascript" src="$sbRoot/js/lib/jquery.scrolltopcontrol-1.1.js"></script>
|
||||
|
|
|
@ -42,7 +42,8 @@
|
|||
Host: '$sg_host',
|
||||
Port: '$sg_port',
|
||||
Root: '$sg_root',
|
||||
UseHttps: #echo ('!1', '!0')[False != $sg_use_https and 0 != $sg_use_https]#
|
||||
UseHttps: #echo ('!1', '!0')[False != $sg_use_https and 0 != $sg_use_https]#,
|
||||
PID: '$sbPID'
|
||||
};
|
||||
//-->
|
||||
</script>
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
/** @namespace $.SickGear.Host */
|
||||
/** @namespace $.SickGear.Port */
|
||||
/** @namespace $.SickGear.UseHttps */
|
||||
/** @namespace $.SickGear.PID */
|
||||
/** @namespace data.msg */
|
||||
|
||||
var sgRoot = $.SickGear.Root,
|
||||
|
@ -10,24 +11,23 @@ var sgRoot = $.SickGear.Root,
|
|||
+ (('' == sgRoot) ? $.SickGear.Port : location.port) + sgRoot,
|
||||
isAliveUrl = sgRoot + '/home/is_alive/',
|
||||
timeoutId;
|
||||
$.SickGear.currentPid = '';
|
||||
$.SickGear.numRestartWaits = 0;
|
||||
|
||||
function is_alive() {
|
||||
timeoutId = 0;
|
||||
$.get(isAliveUrl, function(data) {
|
||||
|
||||
if ('nope' == data.msg.toString()) {
|
||||
var resp = data.msg.toString();
|
||||
if ('nope' == resp) {
|
||||
// if initialising then just wait and try again
|
||||
|
||||
$('#shut_down_message').find('.spinner,.hide-yes').removeClass();
|
||||
$('#restart_message').removeClass();
|
||||
setTimeout(is_alive, 100);
|
||||
|
||||
} else if ('' == $.SickGear.currentPid || $.SickGear.currentPid == data.msg) {
|
||||
} else if (/undefined/i.test($.SickGear.PID) || $.SickGear.PID == resp) {
|
||||
// if this is before we've even shut down then just try again later
|
||||
|
||||
$.SickGear.currentPid = data.msg;
|
||||
setTimeout(is_alive, 100);
|
||||
|
||||
} else {
|
||||
|
|
|
@ -71,9 +71,9 @@ class SBRotatingLogHandler(object):
|
|||
|
||||
handlers = []
|
||||
if not handler:
|
||||
handlers = [self.h_file]
|
||||
if None is not self.h_console:
|
||||
handlers += [self.h_console]
|
||||
handlers = [self.h_console]
|
||||
handlers += [self.h_file]
|
||||
elif not isinstance(handler, list):
|
||||
handlers = [handler]
|
||||
|
||||
|
@ -81,8 +81,9 @@ class SBRotatingLogHandler(object):
|
|||
for logger_name in self.log_types + self.log_types_null:
|
||||
logging.getLogger(logger_name).removeHandler(handler)
|
||||
|
||||
handler.flush()
|
||||
handler.close()
|
||||
if type(handler) != type(logging.StreamHandler()): # check exact type, not an inherited instance
|
||||
handler.flush()
|
||||
handler.close()
|
||||
|
||||
def init_logging(self, console_logging=False):
|
||||
|
||||
|
@ -103,9 +104,10 @@ class SBRotatingLogHandler(object):
|
|||
if self.console_logging:
|
||||
# get a console handler to output INFO or higher messages to sys.stderr
|
||||
h_console = logging.StreamHandler()
|
||||
h_console.setLevel((logging.INFO, logging.DEBUG)[sickbeard.DEBUG])
|
||||
h_console.setFormatter(DispatchingFormatter(self._formatters(), logging.Formatter('%(message)s'), ))
|
||||
self.h_console = h_console
|
||||
if None is not h_console.stream:
|
||||
h_console.setLevel((logging.INFO, logging.DEBUG)[sickbeard.DEBUG])
|
||||
h_console.setFormatter(DispatchingFormatter(self._formatters(), logging.Formatter('%(message)s'), ))
|
||||
self.h_console = h_console
|
||||
|
||||
# add the handler to the root logger
|
||||
for logger_name in self.log_types:
|
||||
|
|
Loading…
Reference in a new issue