You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 7, 2024. It is now read-only.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The reason will be displayed to describe this comment to others. Learn more.
What do you think if I add some functions which respectively obtain new shells from environmental variables, default gateway and the api file. I think the order of shells to try in the function DefautlShell is sensible, as normally the environmental variables are explicitly set by the user and I have tried to use gateway as the the last resort.
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your advise. I will revise it to use map[string]struct{}.
for _, url := range urls {
if encountered[url] != true {
encountered[url] = true
sh := NewShell(url)
_, _, err := sh.Version()
if err == nil {
return sh, nil
}
}
}
return nil, errors.New("No default node is working")
}
func (s *Shell) SetTimeout(d time.Duration) {
s.httpcli.Timeout = d
}
Expand Down
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.
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 spell out exactly how we pick the default shell.
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.
What do you think if I add some functions which respectively obtain new shells from environmental variables, default gateway and the api file. I think the order of shells to try in the function DefautlShell is sensible, as normally the environmental variables are explicitly set by the user and I have tried to use gateway as the the last resort.
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.
Sounds good to me.