Skip to content

Sessions #14195

Answered by SimFG
mig824 asked this question in Q&A
Sessions #14195
Jul 5, 2022 · 1 comment
Discussion options

You must be logged in to vote

maybe you can try concurrency.NewSession(cli, concurrency.WithLease(leaseId)), like:

session, err := concurrency.NewSession(cli)
newSession, nerr := concurrency.NewSession(cli, concurrency.WithLease(session.Lease()))

see more detail:

func TestElectionOnSessionRestart(t *testing.T) {
integration.BeforeTest(t)
clus := integration.NewCluster(t, &integration.ClusterConfig{Size: 1})
defer clus.Terminate(t)
cli := clus.RandClient()
session, err := concurrency.NewSession(cli)
if err != nil {
t.Fatal(err)
}
e := concurrency.NewElection(session, "test-elect")

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by mig824
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants