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

Chunking and CTRL-C handling improvements #95

Merged
merged 2 commits into from
Aug 5, 2024
Merged

Chunking and CTRL-C handling improvements #95

merged 2 commits into from
Aug 5, 2024

Conversation

pkolaczk
Copy link
Owner

@pkolaczk pkolaczk commented Aug 5, 2024

No description provided.

The previous chunking stream adapter had a problem that if
the underlying stream never went into Poll::Pending state,
it looped forever. It never yielded back to the executor,
the time was not properly advanced, and the chunks were
not produced.

This commit fixes it by limiting the number
of items requested from the underlying stream
in a single poll_next, and letting the runtime poll again
immediately if there exist items ready to pick. This way
we give the async runtime a chance to execute a
different future or to do other important stuff.
By moving the SIGTERM logic earlier in the stream
pipeline, now when SIGTERM is received, we emit
and process the last chunk.
@pkolaczk pkolaczk merged commit da407a5 into main Aug 5, 2024
4 checks passed
@pkolaczk pkolaczk deleted the chunking branch August 5, 2024 08:04
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.

1 participant