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
refactor: cat replenish polish #14
Conversation
controller_cat.go
Outdated
|
||
if uint(c.peers.Total()) >= c.net.conf.Target { | ||
break | ||
} | ||
} | ||
|
||
connect = nil |
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.
I was wondering if this nil assignment is actually necessary
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.
It is not necessary
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.
Spent sometime carefully reading the catReplenish function as it looks a pretty important functions.
This function is already the third or fourth rework. I constantly feel like there's an easier way to do it all but I can't think of one, You not finding anything substantially wrong with it makes me feel better about it.
I like these changes.
controller_cat.go
Outdated
|
||
if uint(c.peers.Total()) >= c.net.conf.Target { | ||
break | ||
} | ||
} | ||
|
||
connect = nil |
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.
It is not necessary
Spent sometime carefully reading the catReplenish function as it looks a pretty important functions. Only found some minor polish details that help the readability and comprehension, to me at least, so we can discuss it.
deny
forcanDial
. It allows to remove some negation in condition and have condition readif canDial then add to the list of endpoints to try to connect to
instead of having a guard statement with immediate continue. Matter of style but, I think it's slightly better...minReseed
declaration happening before the special peers handling while not being until after it. (same for the declaration ofattemptsLimit
)