-
Notifications
You must be signed in to change notification settings - Fork 177
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
Add timeouts to eth client #2289
Conversation
minterSess *contracts.MinterSession | ||
livepeerTokenFaucetSess *contracts.LivepeerTokenFaucetSession | ||
// Contracts | ||
controller *contracts.Controller |
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.
Like the refactor, but is this related to the timeouts change? Seems to be the bulk of the PR here.
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 related because before adding the timeout, we actually needed to store sessions here (CallOpts
was encapsulated in the session structs). Now, we don't need sessions, because we always provide our CallOpts
.
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.
Cool! Thanks for clarification
eth/client.go
Outdated
@@ -1101,6 +1089,8 @@ func (c *client) CheckTx(tx *types.Transaction) error { | |||
|
|||
for { | |||
select { | |||
case <-time.After(c.checkTxTimeout): |
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 believe you actually need to create the time.After
timer only once, outside the for
loop, otherwise you will reset the timer for every receipt that you get even if not related to the tx you're checking.
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.
Updated in a354f71
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.
LGTM!
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.
@yondonfu Addressed your comments. PTAL
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.
LGTM after squashing!
ee6a8c1
to
adeb060
Compare
What does this pull request do? Explain your changes. (required)
Add timeouts for
CheckTx()
function and all ETH RPC calls.Note that the timeout values are quite conservative, by default:
CheckTx()
I don't think we need smaller numbers, because in the correct flow of action, these timeouts should never actually be reached.
Specific updates (required)
CheckTx()
executionHow did you test each of these updates (required)
CheckTxTimeout
to 1 ns and check that it always times outethRpcTimeout
to 1 ns and check that all ETH RPC requests failDoes this pull request close any open issues?
fix #2207
Checklist:
make
runs successfully./test.sh
pass