fix: send DONE as text frame, server responds before close
Deploy loadtest / validate (push) Waiting to run
Deploy loadtest / validate (push) Waiting to run
This commit is contained in:
@@ -29,6 +29,8 @@ def ws_upload(ws):
|
|||||||
chunk = ws.receive()
|
chunk = ws.receive()
|
||||||
if chunk is None:
|
if chunk is None:
|
||||||
break
|
break
|
||||||
|
if isinstance(chunk, str) and chunk == 'DONE':
|
||||||
|
break
|
||||||
total += len(chunk)
|
total += len(chunk)
|
||||||
elapsed = round((time.time() - t0) * 1000)
|
elapsed = round((time.time() - t0) * 1000)
|
||||||
ws.send(json.dumps({'ok': True, 'bytes': total, 'elapsed_ms': elapsed}))
|
ws.send(json.dumps({'ok': True, 'bytes': total, 'elapsed_ms': elapsed}))
|
||||||
|
|||||||
+3
-2
@@ -222,10 +222,11 @@ function uploadFileWS(url, f, idx) {
|
|||||||
}
|
}
|
||||||
readNext();
|
readNext();
|
||||||
} else {
|
} else {
|
||||||
// Все чанки ушли — закрываем, сервер поймёт что конец
|
// Последний чанк + сигнал DONE
|
||||||
|
ws.send(e.target.result);
|
||||||
|
ws.send('DONE');
|
||||||
f.progress = 100;
|
f.progress = 100;
|
||||||
renderTable();
|
renderTable();
|
||||||
ws.close();
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
function readNext() {
|
function readNext() {
|
||||||
|
|||||||
Reference in New Issue
Block a user