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

Consul improvements #278

Merged
merged 2 commits into from May 17, 2019
Merged

Consul improvements #278

merged 2 commits into from May 17, 2019

Conversation

Evertras
Copy link
Contributor

  • Instead of the PID, use the generated ID for the service so that a crash/restart will reuse the same key instead of creating dupes that will drop off and destroy our sanity as they bring down modules
  • Increase rate of Consul session refreshes to half of TTL to ensure they remain alive even with latency spikes
  • Don't lock on sessions so a replacement cluster can take over the key safely

Copy link
Member

@stelcheck stelcheck left a comment

Choose a reason for hiding this comment

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

Two small points to have a look at.

lib/serviceDiscovery/engines/consul/index.js Show resolved Hide resolved
if (err) {
return cb(err);
}

const key = [this.path, os.hostname(), process.pid].join('/');
const key = [this.path, os.hostname(), helpers.generateId(port)].join('/');
Copy link
Member

Choose a reason for hiding this comment

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

Should we remove the hostname? In dockerized environment, the hostname will be the container ID, and a new container will have a different ID but might have the same generated ID.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's a good point. I'll switch it to this.path, helpers.generateId instead.

…ease rate of TTL renews for Consul sessions
@stelcheck stelcheck merged commit 89234ca into mage:master May 17, 2019
@Evertras Evertras deleted the consul-key-fix branch May 20, 2019 01:32
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