Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorPatrick Steinhardt <psteinhardt@gitlab.com>2021-10-06 09:56:06 +0300
committerPatrick Steinhardt <psteinhardt@gitlab.com>2021-10-07 10:13:22 +0300
commitff726e130fc73c2b47419ac836a5112cc9d3a181 (patch)
treea13fc8fdec2b20a67af0974f7be83e0a6ae77769 /cmd
parenta980fb11b294e3eff34d793effd7780bcbc4fc90 (diff)
gitaly-backup: Inject connection pool to unleak its Goroutines
The gitaly-backup manager currently creates an ad-hoc instance of the connection pool. This pool never gets cleaned up and thus results in leakage of its connections. Inject the connection pool into the manager and clean it up as required.
Diffstat (limited to 'cmd')
-rw-r--r--cmd/gitaly-backup/create.go6
-rw-r--r--cmd/gitaly-backup/restore.go6
2 files changed, 10 insertions, 2 deletions
diff --git a/cmd/gitaly-backup/create.go b/cmd/gitaly-backup/create.go
index 9dae3d4a5..0ceac7d8e 100644
--- a/cmd/gitaly-backup/create.go
+++ b/cmd/gitaly-backup/create.go
@@ -9,6 +9,7 @@ import (
"runtime"
log "github.com/sirupsen/logrus"
+ "gitlab.com/gitlab-org/gitaly/v14/client"
"gitlab.com/gitlab-org/gitaly/v14/internal/backup"
"gitlab.com/gitlab-org/gitaly/v14/internal/gitaly/storage"
"gitlab.com/gitlab-org/gitaly/v14/proto/go/gitalypb"
@@ -46,7 +47,10 @@ func (cmd *createSubcommand) Run(ctx context.Context, stdin io.Reader, stdout io
return fmt.Errorf("create: resolve locator: %w", err)
}
- manager := backup.NewManager(sink, locator)
+ pool := client.NewPool()
+ defer pool.Close()
+
+ manager := backup.NewManager(sink, locator, pool)
var pipeline backup.Pipeline
pipeline = backup.NewLoggingPipeline(log.StandardLogger())
diff --git a/cmd/gitaly-backup/restore.go b/cmd/gitaly-backup/restore.go
index 695e98cfb..6e119ba92 100644
--- a/cmd/gitaly-backup/restore.go
+++ b/cmd/gitaly-backup/restore.go
@@ -10,6 +10,7 @@ import (
"runtime"
log "github.com/sirupsen/logrus"
+ "gitlab.com/gitlab-org/gitaly/v14/client"
"gitlab.com/gitlab-org/gitaly/v14/internal/backup"
"gitlab.com/gitlab-org/gitaly/v14/internal/gitaly/storage"
"gitlab.com/gitlab-org/gitaly/v14/proto/go/gitalypb"
@@ -48,7 +49,10 @@ func (cmd *restoreSubcommand) Run(ctx context.Context, stdin io.Reader, stdout i
return fmt.Errorf("restore: resolve locator: %w", err)
}
- manager := backup.NewManager(sink, locator)
+ pool := client.NewPool()
+ defer pool.Close()
+
+ manager := backup.NewManager(sink, locator, pool)
var pipeline backup.Pipeline
pipeline = backup.NewLoggingPipeline(log.StandardLogger())