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

perf(reqresp): improve the reqresp request/response methods #6801

Open
wants to merge 2 commits into
base: unstable
Choose a base branch
from

Conversation

nazarhussain
Copy link
Contributor

Motivation

Avoid conditional parameters inside most frequently used methods.

Description

  • For every message on the network sendRequest is used and that includes 4 conditions with ?? on timeout values. These can be avoided.
  • The handleRequest is now renamed as sendResponse to make it aligned with counter part function.
  • For every response to network message handleRequest was extra conditions for timeout values that can be avoided.

Steps to test or reproduce

  • Run all tests

@nazarhussain nazarhussain requested a review from a team as a code owner May 17, 2024 13:41
@nazarhussain nazarhussain self-assigned this May 17, 2024
Copy link

codecov bot commented May 17, 2024

Codecov Report

Attention: Patch coverage is 74.44444% with 23 lines in your changes are missing coverage. Please review.

Project coverage is 61.87%. Comparing base (a6b10df) to head (8fa4fa7).

Additional details and impacted files
@@             Coverage Diff              @@
##           unstable    #6801      +/-   ##
============================================
- Coverage     61.87%   61.87%   -0.01%     
============================================
  Files           562      561       -1     
  Lines         59331    59335       +4     
  Branches       1915     1918       +3     
============================================
+ Hits          36714    36715       +1     
- Misses        22574    22577       +3     
  Partials         43       43              

export async function sendResponse(
peerId: PeerId,
protocolID: string,
{
Copy link
Member

Choose a reason for hiding this comment

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

why did this function signature go from f({a, b, c, d, e}) to f(a, b, {c, modules: {d, e}})

Copy link
Contributor Author

Choose a reason for hiding this comment

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

To make it consistent for request and response methods. Now both functions sendResponse and sendRequest have same function signature with similar options.

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