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

remove duplicate ask and calculate ping before lock #5968

Merged
merged 2 commits into from
Apr 29, 2021

Conversation

deaswang
Copy link
Contributor

@deaswang deaswang commented Apr 6, 2021

No description provided.

Copy link
Contributor

@magik6k magik6k left a comment

Choose a reason for hiding this comment

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

The first ClientQueryAsk usually needs to start a new connection to the miner, which can be many network round trips, and will not give you accurate ping. The second call should use existing libp2p connection, just starting a new stream, and sending the query, which in theory is just 1 network roundtrip, which means that it's good enough to give us accurate ping to the miner.

Ideally we'd just use the libp2p ping protocol, but that would need to be exposed on the API first.

@jennijuju
Copy link
Member

The first ClientQueryAsk usually needs to start a new connection to the miner, which can be many network round trips, and will not give you accurate ping. The second call should use existing libp2p connection, just starting a new stream, and sending the query, which in theory is just 1 network roundtrip, which means that it's good enough to give us accurate ping to the miner.

Ideally we'd just use the libp2p ping protocol, but that would need to be exposed on the API first.

@deaswang Could you please address the review?

@deaswang
Copy link
Contributor Author

Understand. And the time.Now().Sub(rt) before lk.Lock() should be more accurate.

@magik6k magik6k merged commit 462a449 into filecoin-project:master Apr 29, 2021
@deaswang deaswang deleted the ping-ask branch April 30, 2021 03:02
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.

3 participants