-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
GitHub proxy: download GitHub server keys #50891
Conversation
lib/srv/git/github.go
Outdated
} | ||
|
||
func (c *githubMetadataHTTPClient) fetchFingerprints() ([]string, string, error) { | ||
resp, err := http.Get(c.api) |
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.
Why not use https://pkg.go.dev/github.com/google/go-github/v68/github#MetaService.Get instead? This is something that we likely only need to refresh at most every 24 hours or so.
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's a pretty simple get call so i would prefer not to import another package. i also like the idea doing If-None-Match.
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 think I'd rather use pre-existing package to lower the maintenance costs, but it is true an extra dependency of this size is not trivial.
4a2bedb
to
91a7bfd
Compare
e6f0ee3
to
7492d59
Compare
7492d59
to
c794c2f
Compare
return trace.Wrap(err) | ||
} | ||
|
||
// Start background downloads only when git_servers are found. |
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.
Are you sure we can't do the first fetch synchronously when needed instead of setting up a single-use watcher?
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.
as discussed above #50891 (comment), trying to avoid blocking on the first call. also we could retry upon failures this way.
i am happy to revert it to a lazy fetch on first call if we don't think the implementation is worth it.
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 think the async fetch is preferable. There is value in having the overall service up and running as quickly as possible.
* GitHub proxy: download GitHub server keys * review comments
* GitHub proxy: download GitHub server keys (#50891) * GitHub proxy: download GitHub server keys * review comments * remove empty line from bad merge
* GitHub proxy: download GitHub server keys * review comments
Related: