2
0
mirror of https://github.com/xcat2/confluent.git synced 2025-01-28 03:48:35 +00:00

Induce python2 to unicode

eventlet will treat str as binary,
correct by forcing unicode.

For python3, it is a no-op, but
python2 needs it to pass the 'text_type' check in eventlet.
This commit is contained in:
Jarrod Johnson 2021-04-21 15:33:27 -04:00
parent d82690f0d9
commit 479ddd582e
2 changed files with 5 additions and 4 deletions

View File

@ -656,6 +656,7 @@ def become_leader(connection):
reassimilate = eventlet.spawn(reassimilate_missing)
def reassimilate_missing():
eventlet.sleep(30)
while cfm.cfgstreams and _assimilate_missing():
eventlet.sleep(30)

View File

@ -420,11 +420,11 @@ def wsock_handler(ws):
def datacallback(data):
if isinstance(data, dict):
data = json.dumps(data)
ws.send('!' + data)
ws.send(u'!' + data)
elif not isinstance(data, str):
ws.send(' ' + data.decode('utf8'))
ws.send(u' ' + data.decode('utf8'))
else:
ws.send(' ' + data)
ws.send(u' ' + data)
try:
if shellsession:
consession = shellserver.ShellSession(
@ -454,7 +454,7 @@ def wsock_handler(ws):
consession.resize(
width=cmd['width'], height=cmd['height'])
elif clientmsg[0] == '?':
ws.send('?')
ws.send(u'?')
clientmsg = ws.wait()
finally:
consession.destroy()