From 479ddd582efbfaf5eafe6c548f3c654227630a5b Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Wed, 21 Apr 2021 15:33:27 -0400 Subject: [PATCH] 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. --- confluent_server/confluent/collective/manager.py | 1 + confluent_server/confluent/httpapi.py | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/confluent_server/confluent/collective/manager.py b/confluent_server/confluent/collective/manager.py index c4e9d0ac..488704fc 100644 --- a/confluent_server/confluent/collective/manager.py +++ b/confluent_server/confluent/collective/manager.py @@ -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) diff --git a/confluent_server/confluent/httpapi.py b/confluent_server/confluent/httpapi.py index e18c69c5..bd7e9764 100644 --- a/confluent_server/confluent/httpapi.py +++ b/confluent_server/confluent/httpapi.py @@ -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()