Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
adding IsReady to dialer interface #1436
adding IsReady to dialer interface #1436
Changes from 8 commits
fb4a378
41c2f11
2b48657
55ffa64
d39b38f
9f0c6f0
bd1fcf4
45e08c8
76b38eb
38dba03
f67faab
8555f52
4812992
2771c4c
ddc0ce7
fa1391e
5181511
681ae9e
eeb9656
2079bb0
3638a4b
d35e60c
43dd35d
b82c397
04bb1c2
810a92a
6aa256a
e093e69
a5e1ef8
fafdfb9
8f897ac
8eba259
7721192
8b1762d
05a45ed
6063f51
e281571
52d2b46
337278f
3866761
98d477b
8b3f92f
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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 should probably have a way to stop this in the event a
dialer
never becomes ready or becomes ready after new proxies are already assigned. It's kind of unlikely adialer
is never ready, but if someone (probably me) forgets/unaware this goroutine is created, they might not add a timeout to thedialer
themselves.Maybe a
chan
orctx
that gets closed/canceled inReset
and is recreated if we need to wait fordialer
s again?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.
Hmmmmm thanks for the suggestion! I'll make IsReady return an error too, so if err is nil and ok is false then it should try again.
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.
In this way we can also customize when to retry to start a proxy or call the func to create a implementation again depending of the returned error
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.
This will still suffer from the same problem though; It's not guaranteed that
isReady
will eventually return an it's ready or an error. If, at some point, we were to updatewater
to retry downloading the WASM when it fails, or add a new protocol that might not be ready immediately, the caller can't assume that the dialer itself isn't running an infinite loop. Or there might be a bug whereisReady
never returns true or a non nil error. The goroutines won't ever be cleaned up, leading to memory leaks that we may not catch.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.
Hmmmm it makes sense, thanks catching this! I've updated the bypass code:
loadProxyAsync
for creating a context that timeout after 10 min.loadProxyAsync
waits until the context timeout or it receives a channel signal saying it's ready. When ready the internal go routine should stop looping with the flag marked as false and the ready channel is closed.