Repository navigation
feat: Add ConnectOptions.with_auto_token_refresh() - #21
Merged
Merged
Conversation
etcd drops an authentication token that has not been used for `--auth-token-ttl` (300 seconds by default). The Rust client gets a token once at connect and keeps sending it, so once it expires every request fails with `invalid auth token` until the client reconnects. Expose `etcd-client`'s `with_auto_token_refresh()`, which authenticates again and resends the request when the token is rejected. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jopemachine
marked this pull request as ready for review
November 11, 2026 02:32
This was referenced Nov 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
etcd-client'swith_auto_token_refresh()asConnectOptions.with_auto_token_refresh(enabled). When a request is rejected because the authentication token expired, the client authenticates again with the user set bywith_user()and resends the request.--auth-token-ttl(300 seconds by default), and from then on every request fails withetcdserver: invalid auth token.Backend.AI 26.10.0a6 requires an etcd user (BA-8963) and keeps one connection open for the life of each process, so components on a staging cluster with etcd auth enabled started failing with
invalid auth tokena few minutes after start. Backend.AI needs a release with this option to turn it on.Test plan
tests/test_auth.py: on an etcd with auth enabled and--auth-token-ttl 1, a request after the token expired fails withinvalid auth tokenwithout the option and succeeds with ittests/test_auth.py,tests/test_tls.py,cargo clippy,ruff check,mypy🤖 Generated with Claude Code