mirror of
https://github.com/SickGear/SickGear.git
synced 2025-01-22 01:23:43 +00:00
Merge pull request #842 from JackDandy/feature/ChangeLogger
Change logger clean up to prevent lock during restart under pythonw.
This commit is contained in:
commit
fe0aee6440
5 changed files with 17 additions and 13 deletions
|
@ -247,6 +247,7 @@
|
||||||
* Change torrent provider links for bts, et, rarbg, tpb
|
* Change torrent provider links for bts, et, rarbg, tpb
|
||||||
* Change IPT uri used for sanity check
|
* Change IPT uri used for sanity check
|
||||||
* Change PiSexy auth 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)
|
### 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]#',
|
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';
|
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>
|
||||||
<script type="text/javascript" src="$sbRoot/js/lib/jquery.scrolltopcontrol-1.1.js"></script>
|
<script type="text/javascript" src="$sbRoot/js/lib/jquery.scrolltopcontrol-1.1.js"></script>
|
||||||
|
|
|
@ -42,7 +42,8 @@
|
||||||
Host: '$sg_host',
|
Host: '$sg_host',
|
||||||
Port: '$sg_port',
|
Port: '$sg_port',
|
||||||
Root: '$sg_root',
|
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>
|
</script>
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
/** @namespace $.SickGear.Host */
|
/** @namespace $.SickGear.Host */
|
||||||
/** @namespace $.SickGear.Port */
|
/** @namespace $.SickGear.Port */
|
||||||
/** @namespace $.SickGear.UseHttps */
|
/** @namespace $.SickGear.UseHttps */
|
||||||
|
/** @namespace $.SickGear.PID */
|
||||||
/** @namespace data.msg */
|
/** @namespace data.msg */
|
||||||
|
|
||||||
var sgRoot = $.SickGear.Root,
|
var sgRoot = $.SickGear.Root,
|
||||||
|
@ -10,24 +11,23 @@ var sgRoot = $.SickGear.Root,
|
||||||
+ (('' == sgRoot) ? $.SickGear.Port : location.port) + sgRoot,
|
+ (('' == sgRoot) ? $.SickGear.Port : location.port) + sgRoot,
|
||||||
isAliveUrl = sgRoot + '/home/is_alive/',
|
isAliveUrl = sgRoot + '/home/is_alive/',
|
||||||
timeoutId;
|
timeoutId;
|
||||||
$.SickGear.currentPid = '';
|
|
||||||
$.SickGear.numRestartWaits = 0;
|
$.SickGear.numRestartWaits = 0;
|
||||||
|
|
||||||
function is_alive() {
|
function is_alive() {
|
||||||
timeoutId = 0;
|
timeoutId = 0;
|
||||||
$.get(isAliveUrl, function(data) {
|
$.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
|
// if initialising then just wait and try again
|
||||||
|
|
||||||
$('#shut_down_message').find('.spinner,.hide-yes').removeClass();
|
$('#shut_down_message').find('.spinner,.hide-yes').removeClass();
|
||||||
$('#restart_message').removeClass();
|
$('#restart_message').removeClass();
|
||||||
setTimeout(is_alive, 100);
|
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
|
// if this is before we've even shut down then just try again later
|
||||||
|
|
||||||
$.SickGear.currentPid = data.msg;
|
|
||||||
setTimeout(is_alive, 100);
|
setTimeout(is_alive, 100);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -71,9 +71,9 @@ class SBRotatingLogHandler(object):
|
||||||
|
|
||||||
handlers = []
|
handlers = []
|
||||||
if not handler:
|
if not handler:
|
||||||
handlers = [self.h_file]
|
|
||||||
if None is not self.h_console:
|
if None is not self.h_console:
|
||||||
handlers += [self.h_console]
|
handlers = [self.h_console]
|
||||||
|
handlers += [self.h_file]
|
||||||
elif not isinstance(handler, list):
|
elif not isinstance(handler, list):
|
||||||
handlers = [handler]
|
handlers = [handler]
|
||||||
|
|
||||||
|
@ -81,8 +81,9 @@ class SBRotatingLogHandler(object):
|
||||||
for logger_name in self.log_types + self.log_types_null:
|
for logger_name in self.log_types + self.log_types_null:
|
||||||
logging.getLogger(logger_name).removeHandler(handler)
|
logging.getLogger(logger_name).removeHandler(handler)
|
||||||
|
|
||||||
handler.flush()
|
if type(handler) != type(logging.StreamHandler()): # check exact type, not an inherited instance
|
||||||
handler.close()
|
handler.flush()
|
||||||
|
handler.close()
|
||||||
|
|
||||||
def init_logging(self, console_logging=False):
|
def init_logging(self, console_logging=False):
|
||||||
|
|
||||||
|
@ -103,9 +104,10 @@ class SBRotatingLogHandler(object):
|
||||||
if self.console_logging:
|
if self.console_logging:
|
||||||
# get a console handler to output INFO or higher messages to sys.stderr
|
# get a console handler to output INFO or higher messages to sys.stderr
|
||||||
h_console = logging.StreamHandler()
|
h_console = logging.StreamHandler()
|
||||||
h_console.setLevel((logging.INFO, logging.DEBUG)[sickbeard.DEBUG])
|
if None is not h_console.stream:
|
||||||
h_console.setFormatter(DispatchingFormatter(self._formatters(), logging.Formatter('%(message)s'), ))
|
h_console.setLevel((logging.INFO, logging.DEBUG)[sickbeard.DEBUG])
|
||||||
self.h_console = h_console
|
h_console.setFormatter(DispatchingFormatter(self._formatters(), logging.Formatter('%(message)s'), ))
|
||||||
|
self.h_console = h_console
|
||||||
|
|
||||||
# add the handler to the root logger
|
# add the handler to the root logger
|
||||||
for logger_name in self.log_types:
|
for logger_name in self.log_types:
|
||||||
|
|
Loading…
Reference in a new issue