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

chain: refactor process_partial_encoded_chunk_request method #6356

Merged
merged 3 commits into from
Mar 1, 2022

Conversation

mina86
Copy link
Contributor

@mina86 mina86 commented Feb 28, 2022

Extract two more methods from process_partial_encoded_chunk_request
which correspond to if bodies that used to be in it. This makes each
function shorter and thus easier to read especially as in the future
more branches will be added to the method.

Furthermore, move sending of the message to the method changing
maybe_send_partial_encoded_chunk_response into method which prepares
the response only.

This is a pure refactoring with no changes to the behaviour.

Issue: #6242

Extract two more methods from `process_partial_encoded_chunk_request`
which correspond to `if` bodies that used to be in it.  This makes each
function shorter and thus easier to read especially as in the future
more branches will be added to the method.

Furthermore, move sending of the message to the method changing
`maybe_send_partial_encoded_chunk_response` into method which prepares
the response only.

Issue: near#6242
chain/chunks/src/lib.rs Show resolved Hide resolved
self.peer_manager_adapter.do_send(PeerManagerMessageRequest::NetworkRequests(
NetworkRequests::PartialEncodedChunkResponse { route_back, response },
))
}
Copy link
Contributor

Choose a reason for hiding this comment

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

in separate PR:

maybe we should have some stats - on how many times we don't have the response (as normally this should not happen).

chain/chunks/src/lib.rs Outdated Show resolved Hide resolved
@near-bulldozer near-bulldozer bot merged commit 62aa75a into near:master Mar 1, 2022
@mina86 mina86 deleted the oo branch March 1, 2022 16:37
mina86 added a commit to mina86/nearcore that referenced this pull request Apr 7, 2022
…6356)

Extract two more methods from `process_partial_encoded_chunk_request`
which correspond to `if` bodies that used to be in it.  This makes each
function shorter and thus easier to read especially as in the future
more branches will be added to the method.

Furthermore, move sending of the message to the method changing
`maybe_send_partial_encoded_chunk_response` into method which prepares
the response only.

This is a pure refactoring with no changes to the behaviour.

This is commit 62aa75a upstream.

Issue: near#6242
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