From aafb84576fbf6cc4ec67412f98d8b4c46b991b02 Mon Sep 17 00:00:00 2001 From: Hiranmoy Das Chowdhury Date: Mon, 29 Apr 2024 12:31:59 +0600 Subject: [PATCH] xorm client mutex global access added --- pgbouncer/kubedb_client_builder.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pgbouncer/kubedb_client_builder.go b/pgbouncer/kubedb_client_builder.go index 061d37dfd..0d5164ca2 100644 --- a/pgbouncer/kubedb_client_builder.go +++ b/pgbouncer/kubedb_client_builder.go @@ -199,8 +199,8 @@ func GetXormClientList(kc client.Client, pb *api.PgBouncer, ctx context.Context) } func (l *XormClientList) addXormClient(kc client.Client, pb *api.PgBouncer, ctx context.Context, podName string, postgresRef *api.Databases, c chan string, pgReplica int) { xormClient, err := NewKubeDBClientBuilder(kc, pb).WithContext(ctx).WithDatabaseRef(postgresRef).WithPod(podName).GetPgBouncerXormClient() - l.mutex.Lock() - defer l.mutex.Unlock() + l.Mutex.Lock() + defer l.Mutex.Unlock() if err != nil { klog.V(5).ErrorS(err, fmt.Sprintf("failed to create xorm client for pgbouncer %s/%s to make pool with postgres pod %s/%s", pb.Namespace, pb.Name, postgresRef.DatabaseRef.Namespace, postgresRef.DatabaseRef.Name)) l.List = append(l.List, nil)