rpcxio / rpcx-etcd

etcd plugin for rpcx
Apache License 2.0
30 stars 24 forks source link

keepalive在网络不稳定或者etcd服务器不可用的情况下失效 #23

Closed veloting closed 1 year ago

veloting commented 2 years ago

`package main

import ( "fmt" "time"

"github.com/rpcxio/libkv/store"
"github.com/rpcxio/rpcx-etcd/store/etcdv3"

)

func main() { etcdv3.Register() kv, err := etcdv3.New( []string{"127.0.0.1:2379"}, &store.Config{ ConnectionTimeout: 3 * time.Second, Username: "user", Password: "pwd", },
)
if err != nil { fmt.Println(err) return }
kv.Put("test", []byte("test"), nil) select {} } `

  1. go run main.go
  2. kill etcd
  3. wait 30s 等待租约失效
  4. 启动etcd 这个时候租约已经失效这个时候已经不能keepalive

希望能设计成 keeplive失效的时候重新grant之后在put和keepalive(需要保存keepalive的key,val)

smallnest commented 1 year ago

try v0.3.1 please