Skip to content

Commit 0eb26c6

Browse files
Stop restricted proxy handlers promptly during teardown
Signed-off-by: Aakash Saravanan <aakash.saravanan@databricks.com>
1 parent 1f33ada commit 0eb26c6

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

‎tests/e2e/test_kernel_backend.py‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ def conn(kernel_conn_params):
145145
def workspace_only_proxy(kernel_conn_params, monkeypatch):
146146
connections = {"workspace": 0, "blocked": 0}
147147
workspace = kernel_conn_params["server_hostname"] + ":443"
148+
stopping = threading.Event()
148149

149150
class Handler(BaseHTTPRequestHandler):
150151
def do_CONNECT(self):
@@ -159,10 +160,8 @@ def do_CONNECT(self):
159160
connections["workspace"] += 1
160161
self.send_response(200)
161162
self.end_headers()
162-
while True:
163-
ready, _, _ = select.select([self.connection, upstream], [], [], 30)
164-
if not ready:
165-
return
163+
while not stopping.is_set():
164+
ready, _, _ = select.select([self.connection, upstream], [], [], 1)
166165
for source in ready:
167166
data = source.recv(65536)
168167
if not data:
@@ -185,6 +184,7 @@ def log_message(self, *_args):
185184
try:
186185
yield connections
187186
finally:
187+
stopping.set()
188188
proxy.shutdown()
189189
proxy.server_close()
190190
thread.join()

0 commit comments

Comments
 (0)