[lxc-devel] [lxd/master] Increase timeout when calling dqlite.Client.Add() to join the cluster

freeekanayaka on Github lxc-bot at linuxcontainers.org
Mon Apr 6 10:35:28 UTC 2020


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 427 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20200406/b198f2b5/attachment.bin>
-------------- next part --------------
From 4ff5c6aad4c7c4fa29354a5aad0988b14c692f7d Mon Sep 17 00:00:00 2001
From: Free Ekanayaka <free.ekanayaka at canonical.com>
Date: Fri, 3 Apr 2020 15:48:05 +0100
Subject: [PATCH] Increase timeout when calling dqlite.Client.Add() to join the
 cluster

Signed-off-by: Free Ekanayaka <free.ekanayaka at canonical.com>
---
 lxd/cluster/membership.go | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lxd/cluster/membership.go b/lxd/cluster/membership.go
index f3e6cba990..23590ff70e 100644
--- a/lxd/cluster/membership.go
+++ b/lxd/cluster/membership.go
@@ -341,7 +341,7 @@ func Join(state *state.State, gateway *Gateway, cert *shared.CertInfo, name stri
 	logger.Info(
 		"Joining dqlite raft cluster",
 		log15.Ctx{"id": info.ID, "address": info.Address, "role": info.Role})
-	ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
+	ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
 	defer cancel()
 	client, err := client.FindLeader(
 		ctx, gateway.NodeStore(),
@@ -352,6 +352,9 @@ func Join(state *state.State, gateway *Gateway, cert *shared.CertInfo, name stri
 		return errors.Wrap(err, "Failed to connect to cluster leader")
 	}
 	defer client.Close()
+
+	ctx, cancel = context.WithTimeout(context.Background(), time.Minute)
+	defer cancel()
 	err = client.Add(ctx, *info)
 	if err != nil {
 		return errors.Wrap(err, "Failed to join cluster")


More information about the lxc-devel mailing list