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

[fix] - Add Size Method to BufferedReadSeeker and Refactor Context Timeout Handling in HandleFile #3307

Merged
merged 3 commits into from
Sep 23, 2024

Conversation

ahrav
Copy link
Collaborator

@ahrav ahrav commented Sep 19, 2024

Description:

This PR enhances the BufferedReadSeeker with a new Size method for determining the total size of the reader and improves the HandleFile function by centralizing context timeout management.

Changes:

  1. Introduce Size Method to BufferedReadSeeker:

    • Functionality:
      Added a Size method that efficiently retrieves the total size of the underlying reader for both seekable and non-seekable sources by utilizing the existing Seek method.
  2. Refactor Context Timeout Handling in HandleFile:

    • Change:
      Moved the creation and management of the context timeout (processingCtx) outside of each handler within the HandleFile function.
    • Benefit:
      Allows context timeouts to be propagated back to the caller, enabling better external handling and monitoring of timeout events.

Checklist:

  • Tests passing (make test-community)?
  • Lint passing (make lint this requires golangci-lint)?

@ahrav ahrav requested a review from a team September 19, 2024 17:55
@ahrav ahrav marked this pull request as ready for review September 19, 2024 18:17
@ahrav ahrav requested a review from a team as a code owner September 19, 2024 18:17
@ahrav ahrav merged commit 97fd2f8 into main Sep 23, 2024
12 checks passed
@ahrav ahrav deleted the fix-return-ctx-timeout-error branch September 23, 2024 13:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants