Skip to content

Commit 2e1f29c

Browse files
authored
Optimize socket read (#40)
* Optimize JSON parsing from socket stream with JSONStream and improved buffer handling for better performance * Refactor socket reading logic: Replace previous socket.read implementation with a more efficient JSON streaming parser --------- Signed-off-by: tang <38900255+WeiTang-star@users.noreply.github.com>
1 parent bd73829 commit 2e1f29c

1 file changed

Lines changed: 0 additions & 9 deletions

File tree

api/custom_module/sharkd_dict.js

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -186,15 +186,6 @@ send_req = async function(request, sock) {
186186
return null;
187187
}
188188

189-
let data = '';
190-
let chunk = await new_sock.read();
191-
192-
data += chunk;
193-
while (_str_is_json(data) === false) {
194-
chunk = await new_sock.read();
195-
data += chunk;
196-
}
197-
198189
let result = await readAndParseSocket(new_sock);
199190

200191
if ("result" in result) {

0 commit comments

Comments
 (0)