Skip to content

Commit

Permalink
Optimize socket read (#40)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
WeiTang-star authored Aug 28, 2024
1 parent bd73829 commit 2e1f29c
Showing 1 changed file with 0 additions and 9 deletions.
9 changes: 0 additions & 9 deletions api/custom_module/sharkd_dict.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,15 +186,6 @@ send_req = async function(request, sock) {
return null;
}

let data = '';
let chunk = await new_sock.read();

data += chunk;
while (_str_is_json(data) === false) {
chunk = await new_sock.read();
data += chunk;
}

let result = await readAndParseSocket(new_sock);

if ("result" in result) {
Expand Down

0 comments on commit 2e1f29c

Please sign in to comment.