Skip to content
This repository has been archived by the owner on Oct 23, 2024. It is now read-only.

Add Timeout when fetching state.json #341

Merged
merged 1 commit into from
Nov 13, 2015
Merged

Add Timeout when fetching state.json #341

merged 1 commit into from
Nov 13, 2015

Conversation

sargun
Copy link
Contributor

@sargun sargun commented Nov 12, 2015

Fixes #243

@@ -1,6 +1,7 @@
{
"zk": "zk://127.0.0.1:2181/mesos",
"masters": ["127.0.0.1:5050"],
"StateTimeout": 300,
Copy link
Contributor

Choose a reason for hiding this comment

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

probably better named stateTimeoutSeconds (lowercase, and express the unit)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay. I'm going to set the field as StateTimeoutSeconds in JSON, rather than using a JSON Tag.

@jdef
Copy link
Contributor

jdef commented Nov 12, 2015

initial review complete

@@ -67,26 +69,27 @@ type Config struct {
// NewConfig return the default config of the resolver
func NewConfig() Config {
return Config{
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Gofmt shifted everything over due to a longer field

if rip := leaderIP(sj.Leader); rip != ip {
logging.VeryVerbose.Println("Warning: master changed to " + ip)
sj = rg.loadFromMaster(rip, port)
sj, err = rg.loadFromMaster(rip, port)
if err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

why do you need this if? can't you just return sj, err?

@sargun sargun force-pushed the mesos-dns-243 branch 4 times, most recently from 0f603b5 to 65574e9 Compare November 13, 2015 01:43
@@ -164,6 +169,7 @@ func testRecordGenerator(t *testing.T, spec labels.Func, ipSources []string) Rec
if err != nil {
t.Fatal(err)
} else if err = json.Unmarshal(b, &sj); err != nil {
t.Log("err: ", err)
Copy link
Contributor

Choose a reason for hiding this comment

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

this is strange: we're already logging the error w/ t.Fatal(), why the additional t.Log()?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have no idea how this snuck in. Getting rid of it.

@jdef
Copy link
Contributor

jdef commented Nov 13, 2015

nits: otherwise lgtm

 - Adds an integration test to ensure the timeouts work correctly
 - Introduces a new configuration flag: StateTimeoutSeconds
 - Adds stateTimeoutSeconds variable to config.json.sample
@jdef
Copy link
Contributor

jdef commented Nov 13, 2015

:shipit:

sargun added a commit that referenced this pull request Nov 13, 2015
Add Timeout when fetching state.json
@sargun sargun merged commit 9a8aa10 into master Nov 13, 2015
@sttts sttts removed the WIP label Nov 13, 2015
@sargun sargun deleted the mesos-dns-243 branch November 13, 2015 17:10
@sargun sargun restored the mesos-dns-243 branch September 14, 2016 20:53
@alberts alberts deleted the mesos-dns-243 branch January 27, 2017 22:40
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants