Remove sleep hack on startup, move so portal always starts before server.
This commit is contained in:
parent
5cfff771f2
commit
9d0baa2d5c
1 changed files with 9 additions and 15 deletions
|
|
@ -160,19 +160,7 @@ def start_services(server_argv, portal_argv):
|
||||||
return
|
return
|
||||||
queue.put(("portal_stopped", rc)) # this signals the controller that the program finished
|
queue.put(("portal_stopped", rc)) # this signals the controller that the program finished
|
||||||
|
|
||||||
try:
|
|
||||||
if server_argv:
|
|
||||||
# start server as a reloadable thread
|
|
||||||
SERVER = thread.start_new_thread(server_waiter, (processes, ))
|
|
||||||
except IOError, e:
|
|
||||||
print "Server IOError: %s\nA possible explanation for this is that 'twistd' is not found." % e
|
|
||||||
return
|
|
||||||
|
|
||||||
if portal_argv:
|
if portal_argv:
|
||||||
if is_pypy:
|
|
||||||
# This is a hack; without it, the *server* stalls out and never finishes loading under PyPy.
|
|
||||||
time.sleep(1)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if get_restart_mode(PORTAL_RESTART) == "True":
|
if get_restart_mode(PORTAL_RESTART) == "True":
|
||||||
# start portal as interactive, reloadable thread
|
# start portal as interactive, reloadable thread
|
||||||
|
|
@ -180,13 +168,19 @@ def start_services(server_argv, portal_argv):
|
||||||
else:
|
else:
|
||||||
# normal operation: start portal as a daemon; we don't care to monitor it for restart
|
# normal operation: start portal as a daemon; we don't care to monitor it for restart
|
||||||
PORTAL = Popen(portal_argv)
|
PORTAL = Popen(portal_argv)
|
||||||
if not SERVER:
|
|
||||||
# if portal is daemon and no server is running, we have no reason to continue to the loop.
|
|
||||||
return
|
|
||||||
except IOError, e:
|
except IOError, e:
|
||||||
print "Portal IOError: %s\nA possible explanation for this is that 'twistd' is not found." % e
|
print "Portal IOError: %s\nA possible explanation for this is that 'twistd' is not found." % e
|
||||||
return
|
return
|
||||||
|
|
||||||
|
try:
|
||||||
|
if server_argv:
|
||||||
|
# start server as a reloadable thread
|
||||||
|
SERVER = thread.start_new_thread(server_waiter, (processes, ))
|
||||||
|
except IOError, e:
|
||||||
|
print "Server IOError: %s\nA possible explanation for this is that 'twistd' is not found." % e
|
||||||
|
return
|
||||||
|
|
||||||
# Reload loop
|
# Reload loop
|
||||||
while True:
|
while True:
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue