Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Manage our own pushback state #535

Merged
merged 22 commits into from
Sep 6, 2024
Merged

Manage our own pushback state #535

merged 22 commits into from
Sep 6, 2024

Conversation

hadley
Copy link
Member

@hadley hadley commented Sep 4, 2024

Fixes #532. Closes #533.

@hadley hadley requested a review from jcheng5 September 4, 2024 10:22
@jcheng5
Copy link
Member

jcheng5 commented Sep 4, 2024

I think there's a bug in the way I used pushBack to begin with, and persists in this PR. When blocking=FALSE, readLines will return partial lines, and AFAICT we can't distinguish between partial and complete lines. I just pushed a unit test for this.

@jcheng5
Copy link
Member

jcheng5 commented Sep 4, 2024

Alright, I think this is ready

R/req-perform-stream.R Outdated Show resolved Hide resolved
@hadley
Copy link
Member Author

hadley commented Sep 5, 2024

Should we apply the same logic to resp_stream_lines() so that you always get a complete line? Or maybe move the logic that there so that resp_stream_sse() can use resp_stream_lines()?

And does this mean we're drifting away from the idea of blocking vs non-blocking? Or maybe that distinction is no longer useful?

R/req-perform-stream.R Outdated Show resolved Hide resolved
R/req-perform-stream.R Outdated Show resolved Hide resolved
R/req-perform-stream.R Outdated Show resolved Hide resolved
Co-authored-by: Hadley Wickham <[email protected]>
@jcheng5
Copy link
Member

jcheng5 commented Sep 5, 2024

Should we apply the same logic to resp_stream_lines() so that you always get a complete line? Or maybe move the logic that there so that resp_stream_sse() can use resp_stream_lines()?

Uh... it looks like readLines already has the correct behavior--it only returns complete lines, even in nonblocking mode. I'll add a test for this.

Could we have used resp_stream_lines to create resp_stream_sse all along? Was all that logic in resp_stream_sse for nothing!? 😞

And does this mean we're drifting away from the idea of blocking vs non-blocking? Or maybe that distinction is no longer useful?

No, I don't think so? I think we still need blocking for convenience, and non-blocking for async to be possible.

@jcheng5
Copy link
Member

jcheng5 commented Sep 5, 2024

Sorry, I was wrong about readLines not returning partial lines. So pushback would be good here.

@jcheng5
Copy link
Member

jcheng5 commented Sep 6, 2024

Well, that turned out to be quite an adventure. It's good to go now, AFAICT.

@hadley hadley merged commit acaaa9a into main Sep 6, 2024
12 of 13 checks passed
@hadley hadley deleted the manual-pushback branch September 6, 2024 10:08
@jcheng5
Copy link
Member

jcheng5 commented Sep 6, 2024

Sorry that my tests added seconds of latency to the test suite. Is there a way to nudge webfaker from the main testthat process, so we could get rid of those sleep statements?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

req_perform_stream(mode="text") error during error handling
2 participants