-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Added a verbose option for swarm peers. #2713
Conversation
This is used like 'ipfs swarm peers -v'. It prints out the normal peers information, but also the latency of each peer License: MIT Signed-off-by: Chris Sasarak <chris.sasarak@gmail.com>
Options: []cmds.Option{ | ||
cmds.BoolOption("verbose", "v", | ||
`Also display latency along with peer information in the following form: | ||
<peer address> <latency> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are using raw string here. Meaning that now this string includes two new lines and also indentation. Please change it to one line.
If you want to split line you can do it like that
"line1" +
"still line1"
@whyrusleeping might be able to respond to your questions better than I am. If latency isn't stored or exposed easily then it would be worth pinging in batches of few tenths of peers at a time. |
It might be worth to make pinging a separate command, since it doesn't just make the output more verbose, but actually alters the behaviour. |
pContext, cancelFn := context.WithTimeout(req.Context(), timeout) | ||
defer cancelFn() | ||
|
||
ch, _ := pingService.Ping(pContext, pid) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can grab this information from n.Peerstore.LatencyEWMA(peer)
no need to ping each peer for it
That's significantly easier than what I was doing, thanks! I'll edit this tonight. |
License: MIT Signed-off-by: Chris Sasarak <chris.sasarak@gmail.com>
I've incorporated the changes everyone discussed. I failed one of the tests, but haven't merged in master. Do you all prefer that I squash/rebase my commits, I merge master and push to my branch with a merge commit? |
@csasarak i can squash the commits here on github. And teamcity always tests the merge commit of your branch and latest master. |
This LGTM |
This is used like 'ipfs swarm peers -v'. It prints out the normal peers
information, but also the latency of each peer
License: MIT
Signed-off-by: Chris Sasarak chris.sasarak@gmail.com