Skip to content

Conversation

@ShimmerGlass
Copy link
Collaborator

This adds support for prepared queries destinations in addition to
service ones: an upstream can now target a prepared query and benefit
from features such as fallback between DCs.
Since prepared queries do not support bloquing requests this uses polling
to periodically check for changes. The default polling rate is 30s: the
same as the one consul uses, and can be overriden with the "poll_interval"
config option.

@ShimmerGlass ShimmerGlass force-pushed the prepared-queries branch 2 times, most recently from c59c254 to c1b786d Compare May 15, 2020 12:36
@pierresouchay
Copy link
Collaborator

Can you force-push again to pass the unit tests?

This adds support for prepared queries destinations in addition to
service ones: an upstream can now target a prepared query and benefit
from features such as fallback between DCs.
Since prepared queries do not support bloquing requests this uses polling
to periodically check for changes. The default polling rate is 30s: the
same as the one consul uses, and can be overriden with the "poll_interval"
config option.
Copy link
Collaborator

@pierresouchay pierresouchay left a comment

Choose a reason for hiding this comment

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

I am Ok, implementation sounds good, but I would like to have exponential backoff in case of failure and ability to tune the prepared query interval if possible

})
if err != nil {
w.log.Errorf("consul: error fetching service definition for service %s: %s", up.DestinationName, err)
time.Sleep(errorWaitTime)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you do a truncated binary exponential backoff instead of a fixed one ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I can, however, that's how errors are handled in all the other watches. I can make this a separate PR.

last = nodesP
}

time.Sleep(interval)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I am Ok with 30s as a default duration, but could you make it configurable ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes, sorry

Copy link
Collaborator

@pierresouchay pierresouchay left a comment

Choose a reason for hiding this comment

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

OK for me, but exponential back off seems important to me, but OK in another PR

@aiharos aiharos merged commit 31ce192 into master May 26, 2020
@ShimmerGlass ShimmerGlass deleted the prepared-queries branch August 14, 2020 08:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants