refactor(grpc): bind TCP listener before etcd registration to prevent connection issues

- Change tokio-stream dependency to include net feature for TcpListenerStream
- Move TCP listener binding before etcd registry initialization in main function
- Pass pre-bound TcpListener to gRPC server instead of just SocketAddr
- Update gRPC server to use serve_with_incoming with TcpListenerStream
- Prevent peers from attempting connections before gRPC server is ready
- Ensure proper error handling for TCP binding failures during startup
This commit is contained in:
zhenyi
2026-06-11 23:07:36 +08:00
parent b797e360c0
commit 5f4e9bdfa7
3 changed files with 15 additions and 7 deletions
+1 -1
View File
@@ -49,7 +49,7 @@ tonic-prost = "0.14"
tonic-health = "0.14.6"
url = "2.5"
etcd-client = { version = "0.18", features = ["tls"] }
tokio-stream = "0.1"
tokio-stream = { version = "0.1", features = ["net"] }
async-nats = "0.49"
futures-util = "0.3"
utoipa = { version = "5", features = ["uuid","chrono","actix_extras","decimal","macros"]}