From 6f15aab6eb162f7bd85dc6ae00e2cd2a75588697 Mon Sep 17 00:00:00 2001 From: Michael Moser Date: Tue, 4 Aug 2020 04:15:21 +0300 Subject: [PATCH] app is no longer stuck when handling web socket. --- s9k.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/s9k.py b/s9k.py index dfe9d3c..a305c65 100755 --- a/s9k.py +++ b/s9k.py @@ -1,15 +1,15 @@ #!/usr/bin/python3 -import subprocess import logging import shlex import argparse -import select import os from geventwebsocket import WebSocketError from geventwebsocket.handler import WebSocketHandler from gevent import pywsgi +from gevent.select import select from gevent.subprocess import Popen, PIPE + import bottle from bottle.ext.websocket import GeventWebSocketServer from bottle.ext.websocket import websocket @@ -312,7 +312,10 @@ def make_script_switch_to_edit(): class ApiResources: def __init__(self): - pass + self.html_table = None + self.name_index = None + self.namespaced_index = None + self.error_message = None def load(self): cmd = params.command_name + " api-resources" @@ -695,7 +698,7 @@ def echo(web_socket): try: #print("before select") read_sock, _, error_socks = \ - select.select([fd_stream, fd_out], [], [fd_stream, fd_out], 1) + select([fd_stream, fd_out], [], [fd_stream, fd_out], 1) #print("after select read_events {} error_events {}".\ # format(len(read_sock), len(error_socks)))