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

Allow workaround for discovery startup race #258

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

KnicKnic
Copy link
Contributor

@KnicKnic KnicKnic commented Jan 18, 2020

Related to issue #257

This is not full fix, however will allow an application that is written correctly to not hit the race. What the application would have to do is create the server with no backends, and then immediately update the backends with the backend pool that they want.

This race can be hit using the rest api, or when embeding gobetween as a library.

manager.Create("foo", config.Server{
    Protocol: "tcp",
    Bind:     "127.0.0.1:199",
    Discovery: &config.DiscoveryConfig{
        Kind:                  "static",
        StaticDiscoveryConfig: &config.StaticDiscoveryConfig{StaticList: []string{}},
    },
})
manager.UpdateBackends("foo", &[]core.Backend{core.Backend{Target: core.Target{Host: "127.0.0.1", Port: "8990"}, Stats: core.BackendStats{Live: true}}})

@KnicKnic
Copy link
Contributor Author

KnicKnic commented Aug 4, 2020

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.

None yet

2 participants