Skip to content
This repository has been archived by the owner on Mar 29, 2024. It is now read-only.

fix(lease): should not panic on keep_alive #85

Merged
merged 1 commit into from
Apr 10, 2023

Conversation

Dreamacro
Copy link
Contributor

Currently in LeaseKeepAlive, calling the keep_alive function may cause a panic if a send operation is performed on req_tx.

There may be some network fluctuations due to poor network conditions in my usage environment (due to cross-border use). I have a keep-alive logic that calls keep_alive_for for retries during fluctuations, which caused this panic in actual scenarios.

thread 'tokio-runtime-worker' panicked at 'emit keep alive request to channel: SendError(LeaseKeepAliveRequest { id: 7587869483910042079 })', /home/.cargo/registry/src/index.crates.io-6f17d22bba15001f/etcd-rs-1.0.0/src/lease/mod.rs:72:14

Therefore, when send fails, I use the same logic as keep_alive_for to return a channel close error.

Copy link
Owner

@zarvd zarvd left a comment

Choose a reason for hiding this comment

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

LGTM

@zarvd zarvd merged commit 1de860d into zarvd:master Apr 10, 2023
@Dreamacro Dreamacro deleted the lease-not-panic branch April 10, 2023 15:16
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants