Skip to content
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

pkg/stash: add Etcd as a SingleFlight backend #1070

Merged
merged 6 commits into from
Feb 22, 2019

Conversation

marwan-at-work
Copy link
Contributor

This is a more polished version of my previous PR (#933)

It fixes the review comments, merge conflicts, and is also no longer WIP so it's ready to merge.
Apologies if I missed any of the previous comments, feel free to call them out.

Fixes #760

@codecov-io
Copy link

codecov-io commented Feb 19, 2019

Codecov Report

Merging #1070 into master will decrease coverage by 1.53%.
The diff coverage is 2.35%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1070      +/-   ##
==========================================
- Coverage   54.83%   53.29%   -1.54%     
==========================================
  Files          79       80       +1     
  Lines        2639     2719      +80     
==========================================
+ Hits         1447     1449       +2     
- Misses       1073     1151      +78     
  Partials      119      119
Impacted Files Coverage Δ
cmd/proxy/actions/app.go 0% <0%> (ø) ⬆️
cmd/proxy/actions/app_proxy.go 0% <0%> (ø) ⬆️
pkg/stash/with_etcd.go 0% <0%> (ø)
pkg/config/config.go 38.33% <100%> (+1.04%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 258e8b1...bcf16ef. Read the comment docs.

Copy link
Member

@arschles arschles left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@marwan-at-work not only is this awesome on its own, but it'll be a great blueprint go build other drivers after this goes in. thank you 🎉

I left some nits, small requests and questions in here

volumes:
etcd0:
etcd1:
etcd2:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@marwan-at-work nit: can you add a newline at the end of the file?

// that helps Athens connect to the
// Etcd backends.
type Etcd struct {
Endpoints string
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explicitly name this and the above struct field with tags? I think explicit is better than implicit here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@arschles +1 on this field, missed the env override. But the above struct field does not need it just like the StorageConfig

})
}

err = eg.Wait()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a way to do this with a timeout? it'd be nice to avoid having integration tests hang forever if there's something wrong with an etcd server running in docker or something else. maybe this can be done by creating eg with a context that times out? I don't remember if that's how it works...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@arschles nice suggestion, I'll add a timeout on the context of the Stash function, should work fine.

Copy link
Member

@arschles arschles left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -39,6 +39,8 @@ type Config struct {
HGRCPath string `envconfig:"ATHENS_HGRC_PATH"`
TLSCertFile string `envconfig:"ATHENS_TLSCERT_FILE"`
TLSKeyFile string `envconfig:"ATHENS_TLSKEY_FILE"`
SingleFlightType string `envconfig:"ATHENS_SINGLE_FLIGHT_TYPE"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@arschles arschles merged commit 12ce2a6 into gomods:master Feb 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement Distributed Deduplication Mechanisms
3 participants