Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
api-gateway: fix cache and service deletion issue #2377
api-gateway: fix cache and service deletion issue #2377
Changes from 9 commits
896970c
a7dfa1c
6edf812
213a4d0
ef87e89
b088e35
1dd8c81
7513cbc
39d93a1
8681705
3178b1b
979c906
02fe6d1
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Confirmed that this channel isn't being used anywhere. It looks like it was a copy-paste leftover in a previous PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Solidifying my own understanding by writing it out:
Since the
r.events
channel is not buffered and nothing was reading from the channel, the first run through this code would block on the write. The context also was still open, soctx.Done()
wasn't happening either.As a result, we would never move past this
select
to the next iteration of ourfor
loop to refresh our cache, so it would very quickly become stale. Removing this code allows our loop to continue executing just as intended so that our cache is updated regularly.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commenting here so it's less likely to get lost. Removing the channel writing code seems fine to me, I believe it was originally there to re-trigger reconciliation if a derived Consul service was changed (like if someone manually deregistered the service for some odd reason, in which case we'd just re-register it), but clearly I forgot to hook it into our
Watch
routines 😬It's probably "more correct" to do it with the Watch, but that seems to be a small enough edge-case to me where I think dropping this here is fine. If we need to add it back in later though, we can.