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

Fix QueueSubscribeSync and backoff errors #146

Merged
merged 3 commits into from
Aug 30, 2023

Conversation

jnschaeffer
Copy link
Contributor

Core NATS subscriptions were incorrectly using SubscribeSync instead of QueueSubscribeSync and both core and JetStream subscriptions were waiting for the backoff period (default 5 seconds) for all iterations of the worker loop, not just error conditions. This PR fixes both issues.

By default, NATS will send requests to all consumers that can respond
unless they are part of the same queue group. This commit updates
coreSubscribe to use the configured queue group for the connection to
ensure only one consumer receives a request.

Signed-off-by: John Schaeffer <jschaeffer@equinix.com>
As written, if a message is not received before the context times out
in coreSubscribe and jsSubscribe, the subscriber will wait for the
duration of the backoff period. This commit updates coreSubscribe and
jsSubscribe to not wait to keep processing messages if the current
polling iteration simply expired.

Signed-off-by: John Schaeffer <jschaeffer@equinix.com>
@jnschaeffer jnschaeffer requested a review from a team as a code owner August 30, 2023 17:25
events/nats_subscribe.go Outdated Show resolved Hide resolved
Signed-off-by: John Schaeffer <jschaeffer@equinix.com>
@jnschaeffer jnschaeffer added this pull request to the merge queue Aug 30, 2023
Merged via the queue into infratographer:main with commit f271e55 Aug 30, 2023
@jnschaeffer jnschaeffer deleted the events-fixes branch August 30, 2023 17:46
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