Browse Source

Significantly reduce startuptime by lowering CP check_port timeout

pull/745/head
Safihre 9 years ago
parent
commit
a922da5868
  1. 13
      SABnzbd.py

13
SABnzbd.py

@ -57,7 +57,6 @@ if [int(n) for n in cherrypy.__version__.split('.')] < [8, 1, 2]:
sys.exit(1)
from cherrypy import _cpserver
from cherrypy import _cpwsgi_server
SQLITE_DLL = True
try:
@ -709,7 +708,7 @@ def find_free_port(host, currentport):
n = 0
while n < 10 and currentport <= 49151:
try:
cherrypy.process.servers.check_port(host, currentport)
cherrypy.process.servers.check_port(host, currentport, timeout=0.1)
return currentport
except:
currentport += 5
@ -1072,13 +1071,13 @@ def main():
if sabnzbd.DAEMON:
if enable_https and https_port:
try:
cherrypy.process.servers.check_port(cherryhost, https_port)
cherrypy.process.servers.check_port(cherryhost, https_port, timeout=0.1)
except IOError, error:
Bail_Out(browserhost, cherryport)
except:
Bail_Out(browserhost, cherryport, '49')
try:
cherrypy.process.servers.check_port(cherryhost, cherryport)
cherrypy.process.servers.check_port(cherryhost, cherryport, timeout=0.1)
except IOError, error:
Bail_Out(browserhost, cherryport)
except:
@ -1100,7 +1099,7 @@ def main():
if enable_https:
port = https_port or cherryport
try:
cherrypy.process.servers.check_port(browserhost, port)
cherrypy.process.servers.check_port(browserhost, port, timeout=0.1)
except IOError, error:
if str(error) == 'Port not bound.':
pass
@ -1122,7 +1121,7 @@ def main():
# NonSSL
try:
cherrypy.process.servers.check_port(browserhost, cherryport)
cherrypy.process.servers.check_port(browserhost, cherryport, timeout=0.1)
except IOError, error:
if str(error) == 'Port not bound.':
pass
@ -1512,7 +1511,7 @@ def main():
try:
# Use internal cherrypy check first to prevent ugly tracebacks
cherrypy.process.servers.check_port(browserhost, cherryport)
cherrypy.process.servers.check_port(browserhost, cherryport, timeout=0.1)
cherrypy.engine.start()
except IOError, error:
if str(error) == 'Port not bound.':

Loading…
Cancel
Save