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

Commits on Aug 5, 2024

  1. Chunk stream properly if underlying stream always ready

    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.
    pkolaczk committed Aug 5, 2024
    Configuration menu
    Copy the full SHA
    946f7b0 View commit details
    Browse the repository at this point in the history
  2. Don't throw away the last chunk of data on SIGTERM (Ctrl-C)

    By moving the SIGTERM logic earlier in the stream
    pipeline, now when SIGTERM is received, we emit
    and process the last chunk.
    pkolaczk committed Aug 5, 2024
    Configuration menu
    Copy the full SHA
    fd20881 View commit details
    Browse the repository at this point in the history