Skip to content

refactor: always attemp to reset readers during retry#7

Merged
knight42 merged 1 commit intov2from
refactor/always-reset-reader
Nov 1, 2025
Merged

refactor: always attemp to reset readers during retry#7
knight42 merged 1 commit intov2from
refactor/always-reset-reader

Conversation

@knight42
Copy link
Copy Markdown
Contributor

@knight42 knight42 commented Nov 1, 2025

No description provided.

Copilot AI review requested due to automatic review settings November 1, 2025 15:48
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR simplifies the retry mechanism by making reader reset functionality unconditional, removing the SetRetryResetReaders API and related configuration. The change makes all io.ReadSeeker implementations (including multipart fields and request bodies) reset automatically on retry attempts.

  • Removed SetRetryResetReaders() method and RetryResetReaders field from the Client
  • Made reader reset behavior unconditional in the retry logic
  • Refactored createHTTPRequest to use http.NewRequestWithContext directly instead of calling WithContext separately
  • Increased test tolerance for timing precision from 1ms to 100ms

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
client.go Removed RetryResetReaders field and SetRetryResetReaders() method
retry.go Removed ResetMultipartReaders() option function and made reader reset unconditional, removed unused resetReaders field from Options struct
request.go Removed ResetMultipartReaders option from retry configuration
middleware.go Refactored to use http.NewRequestWithContext and moved trace initialization before request creation
retry_test.go Removed SetRetryResetReaders(true) calls from tests and increased timing tolerance to 100ms
request_test.go Removed SetRetryResetReaders(true) call from test
multipart_test.go Removed SetRetryResetReaders(true) call from test
Comments suppressed due to low confidence (1)

retry.go:47

  • The resetReaders field is no longer used in the Options struct after removing the ResetMultipartReaders() function, but it still exists in the struct definition. This unused field should be removed to maintain code cleanliness.
		resetReaders    bool

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread middleware.go
Signed-off-by: Zack Zeng <zackzeng96@gmail.com>
@knight42 knight42 force-pushed the refactor/always-reset-reader branch from 42d980e to 0886b1c Compare November 1, 2025 15:52
@knight42 knight42 enabled auto-merge (squash) November 1, 2025 15:52
@knight42 knight42 merged commit 3aba07e into v2 Nov 1, 2025
1 check passed
@knight42 knight42 deleted the refactor/always-reset-reader branch November 1, 2025 15:54
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.

2 participants