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

Pre-resolve upstreams and skip nginx configtest. #312

Merged
merged 20 commits into from
Jun 17, 2019

Conversation

baconmania
Copy link
Contributor

No description provided.

} else if (upstream instanceof UpstreamInfo) {
UpstreamInfo upstreamInfo = ((UpstreamInfo) upstream);
LOG.trace("Trying to resolve an UpstreamInfo upstream of {} with upstreamInfo.getResolvedUpstream() = {}, resolver.resolveUpstreamDNS(upstreamInfo.getUpstream()) = {}, upstreamInfo.getUpstream() = {}", upstreamInfo, upstreamInfo
.getResolvedUpstream(), resolver.resolveUpstreamDNS(upstreamInfo.getUpstream()), upstreamInfo.getUpstream());
Copy link
Member

Choose a reason for hiding this comment

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

Looks like this trace line will cause us to call resolveUpstreamDNS twice rather than one and storing in a variable for logging.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch

return Optional.of(String.format("%s:%d", ip, port));
} else {
try {
InetAddresses.forString(address);
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 reason we don't try using the cache if it doesn't contain a :?

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 carried this code over from ResolveUpstreamHelper, but now you mention it, I don't see a reason for that. Gonna fix that 👍

&& allUpstreamsAreResolved(maybeResolvedRemoveUpstreams)
&& allUpstreamsAreResolved(maybeResolvedReplaceUpstreams)) {
LOG.trace("Request {} does not change a BaragonService and all upstreams were pre-resolved. Setting noValidate.", nonServiceChangeRequest.request.getQueuedRequestId().getRequestId());
BaragonRequest requestWithResolvedUpstreams = new BaragonRequestBuilder()
Copy link
Member

Choose a reason for hiding this comment

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

is it worth making a toBuilder on BaragonRequest?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Probs, yeah. There's a lot of copy boilerplate at the moment

@baconmania baconmania merged commit 8dedacd into set-noValidate-if-possible Jun 17, 2019
@baconmania baconmania deleted the pre-resolve-upstreams branch June 17, 2019 18:42
@baconmania baconmania added this to the 0.9.0 milestone Jun 17, 2019
@baconmania baconmania restored the pre-resolve-upstreams branch June 17, 2019 22:05
@ssalinas ssalinas deleted the pre-resolve-upstreams branch July 17, 2020 18:54
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.

2 participants