Repository navigation
fix: close interrupted asynchronous file uploads - #275
Open
Apeksha9389 wants to merge 1 commit into
Open
Apeksha9389 wants to merge 1 commit into
Apeksha9389 wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
AsyncTranscriber.upload_file(path)leaves its opened file suspended in the upload generator when HTTP transmission fails, is cancelled, or returns before consuming the whole body. The file remains open after the method exits, until asynchronous generator finalization eventually runs. Repeated interrupted uploads can retain file descriptors and prevent immediate file cleanup on platforms that lock open files.Close the SDK-created upload generator in
finally, triggering the existing path iterator's file cleanup before returning or propagating the original error. Caller-supplied file objects remain caller-owned. Generator annotations now exposeaclose()to type checkers. There is no public API change.Validation: all 745 unit tests pass on Python 3.12, and Ruff check/format pass on the changed files. The three new path regressions (write error, cancellation, early HTTP response) all fail on unchanged master; the caller-owned-file control passes there. Tests use a local custom httpx transport that consumes one chunk before stopping, with real temporary files. No provider requests or live transcription were run.