Skip to content

Commit

Permalink
attempt ringabout#3 ??? 10s blocks on concurrent calls, eventually co…
Browse files Browse the repository at this point in the history
…mplete is called before write
  • Loading branch information
termermc committed Apr 1, 2023
1 parent dc09657 commit 9e4b513
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/httpx.nim
Original file line number Diff line number Diff line change
Expand Up @@ -490,10 +490,10 @@ proc processEvents(selector: Selector[Data],
echo "WHILE TRUE LOOP TOP"

# If the request body stream queue is full, wait until it stops being full
# when httpxUseStreams:
# if unlikely(data.bodyStream.len >= httpxMaxStreamQueueSize):
# echo "BREAK"
# break
when httpxUseStreams:
if unlikely(data.bodyStream.len >= httpxMaxStreamQueueSize):
echo "BREAK"
break

echo "Waiting on RECV..."
let ret = recv(fd.SocketHandle, addr buf[0], httpxClientBufSize, 0.cint)
Expand Down Expand Up @@ -606,9 +606,7 @@ proc processEvents(selector: Selector[Data],
for i in 0 ..< ret:
chunk[i] = buf[i]

# TODO Figure out better workaround
if likely(not data.bodyStream.finished):
asyncCheck data.bodyStream.write(chunk)
asyncCheck data.bodyStream.write(chunk)
data.bodyBytesRead += ret.BiggestUInt
echo "WROTE, NOW SIZE: " & $data.bodyBytesRead

Expand Down

0 comments on commit 9e4b513

Please sign in to comment.