Skip to content

Conversation

@sanych-sun
Copy link
Member

@sanych-sun sanych-sun commented Oct 31, 2025

The PR is created based on 3.5.x branch, here is the custom EG patch to validate it's green:
https://spruce.mongodb.com/version/69052114d023dd0007b247d7

@sanych-sun sanych-sun requested a review from a team as a code owner October 31, 2025 20:47
@sanych-sun sanych-sun requested review from BorisDog and ajcvickers and removed request for a team and ajcvickers October 31, 2025 20:47
@sanych-sun sanych-sun added the bug Fixes issues or unintended behavior. label Oct 31, 2025
Copy link
Contributor

@BorisDog BorisDog left a comment

Choose a reason for hiding this comment

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

Looks good, few small comments.


cancellationToken.ThrowIfCancellationRequested();
throw new TimeoutException();
return UseStreamWithTimeout(
Copy link
Contributor

Choose a reason for hiding this comment

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

Few naming suggestions:
UseStreamWithTimeout -> rename to ExecuteOperationWithTimeout?
method -> rename to operation?

}
}

private static TResult UseStreamWithTimeout<TResult, TState>(Stream stream, Func<Stream, TState, TResult> method, TState state, TimeSpan timeout, CancellationToken cancellationToken)
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe just
byte[] buffer, int offset, int count instead of state, as it's the same in both cases?

{
private int _operationState = 0;

public OperationState OperationState
Copy link
Contributor

Choose a reason for hiding this comment

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

public OperationState OperationState => (OperationState)_operationState;

try
{
var result = method(stream, state);
if (callbackState?.TryChangeState(OperationState.Done) == false)
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe TryChangeStateFromInProgress for more clarity?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Fixes issues or unintended behavior.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants