2
0
mirror of https://github.com/xcat2/confluent.git synced 2024-11-22 09:32:21 +00:00

Guarantee consoleserver init before use

During a restart, a client may aggressively trigger
console reconnect before the consoleserver starts.

Make sure that the daemon is running and globals
ready before API could possible ask for console.
This commit is contained in:
Jarrod Johnson 2021-04-02 13:57:45 -04:00
parent 92a10ede11
commit 14d13749ad
2 changed files with 4 additions and 1 deletions

View File

@ -586,7 +586,7 @@ def _start_tenant_sessions(cfm):
cfm.watch_nodecollection(_nodechange)
def start_console_sessions():
def initialize():
global _tracelog
global _bufferdaemon
global _bufferlock
@ -598,6 +598,8 @@ def start_console_sessions():
fl = fcntl.fcntl(_bufferdaemon.stdout.fileno(), fcntl.F_GETFL)
fcntl.fcntl(_bufferdaemon.stdout.fileno(),
fcntl.F_SETFL, fl | os.O_NONBLOCK)
def start_console_sessions():
configmodule.hook_new_configmanagers(_start_tenant_sessions)

View File

@ -260,6 +260,7 @@ def run(args):
os.umask(oumask)
http_bind_host, http_bind_port = _get_connector_config('http')
sock_bind_host, sock_bind_port = _get_connector_config('socket')
consoleserver.initialize()
webservice = httpapi.HttpApi(http_bind_host, http_bind_port)
webservice.start()
disco.start_detection()