From 3ad53a3aacf5112c564b16233f528b570b52176b Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Fri, 27 Sep 2024 15:30:59 -0400 Subject: [PATCH] Fix client file staging Skip read during httpapi, and inject sleep between file transfer chunks. --- confluent_server/confluent/core.py | 1 + confluent_server/confluent/httpapi.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/confluent_server/confluent/core.py b/confluent_server/confluent/core.py index 5ef9271b..528c3f21 100644 --- a/confluent_server/confluent/core.py +++ b/confluent_server/confluent/core.py @@ -1343,6 +1343,7 @@ def handle_staging(pathcomponents, operation, configmanager, inputdata): datachunk = filedata['wsgi.input'].read(min(chunk_size, remaining_length)) f.write(datachunk) remaining_length -= len(datachunk) + eventlet.sleep(0) yield msg.FileUploadProgress(progress) yield msg.FileUploadProgress(100) diff --git a/confluent_server/confluent/httpapi.py b/confluent_server/confluent/httpapi.py index 5b00f4a8..7a40a988 100644 --- a/confluent_server/confluent/httpapi.py +++ b/confluent_server/confluent/httpapi.py @@ -681,7 +681,7 @@ def resourcehandler_backend(env, start_response): start_response('302 Found', headers) yield '' return - if 'CONTENT_LENGTH' in env and int(env['CONTENT_LENGTH']) > 0: + if 'CONTENT_LENGTH' in env and int(env['CONTENT_LENGTH']) > 0 and not '/staging' in env['PATH_INFO']: reqbody = env['wsgi.input'].read(int(env['CONTENT_LENGTH'])) reqtype = env['CONTENT_TYPE'] operation = opmap.get(env['REQUEST_METHOD'], None)