Skip to content

feat: transparent leader hint reconnect on consume#2

Merged
vieiralucas merged 8 commits intomainfrom
feat/leader-hint-reconnect
Mar 24, 2026
Merged

feat: transparent leader hint reconnect on consume#2
vieiralucas merged 8 commits intomainfrom
feat/leader-hint-reconnect

Conversation

@vieiralucas
Copy link
Copy Markdown
Member

@vieiralucas vieiralucas commented Mar 22, 2026

Summary

  • When consume receives gRPC UNAVAILABLE with x-fila-leader-addr metadata, the client transparently reconnects to the leader node and retries once
  • Max 1 redirect per consume call to prevent infinite loops
  • UNAVAILABLE errors without the leader hint metadata are raised as RPCError as before

Test plan

  • Verify existing integration tests still pass (enqueue/consume/ack, nack redeliver)
  • Verify UNAVAILABLE without leader hint raises RPCError
  • Verify UNAVAILABLE with leader hint reconnects to the indicated address
  • Verify a second redirect on the retry raises RPCError (no infinite loop)

🤖 Generated with Claude Code


Summary by cubic

consume now auto-reconnects once to the leader on gRPC UNAVAILABLE when x-fila-leader-addr is present, rebuilding the stub with cached TLS credentials to keep the stream alive.

  • New Features

    • Follow the leader hint once per consume; a second redirect raises RPCError.
    • UNAVAILABLE without the hint raises RPCError; Cancelled and NotFound unchanged.
    • Redirect logic runs in consume_with_redirect.
  • Refactors

    • Cache TLS channel credentials in @credentials; added extract_leader_addr and made LEADER_ADDR_KEY private.
    • Inlined close and trimmed method docs to pass RuboCop’s 100-line class limit.
    • Condensed build_channel_credentials branching for brevity.

Written for commit 7601fb1. Summary will update on new commits.

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

No issues found across 1 file

@vieiralucas vieiralucas force-pushed the feat/leader-hint-reconnect branch from 0f3080e to a06a119 Compare March 24, 2026 01:54
@vieiralucas vieiralucas merged commit 9f31a58 into main Mar 24, 2026
3 checks passed
@vieiralucas vieiralucas deleted the feat/leader-hint-reconnect branch March 24, 2026 02:10
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.

1 participant