diff options
author | Ævar Arnfjörð Bjarmason <avar@gitlab.com> | 2021-01-19 13:16:56 +0300 |
---|---|---|
committer | Ævar Arnfjörð Bjarmason <avar@gitlab.com> | 2021-01-19 13:16:56 +0300 |
commit | c89fdf6bb2dc9f652f5c724caf13d3bde76e9d90 (patch) | |
tree | 5ecb304037e13e70ddb02ae707737ad514436eee | |
parent | bfbd64eceae6adf1b2066abaf1f144779bd52580 (diff) | |
parent | d023af5566b798c227114c14f1012a4beb868a9c (diff) |
Merge branch 'pks-replicate-repository-cancellation' into 'master'
repository: Fix ReplicateRepository returning before RPCs have finished
See merge request gitlab-org/gitaly!3011
-rw-r--r-- | changelogs/unreleased/pks-replicate-repository-cancellation.yml | 5 | ||||
-rw-r--r-- | internal/gitaly/service/repository/replicate.go | 8 |
2 files changed, 12 insertions, 1 deletions
diff --git a/changelogs/unreleased/pks-replicate-repository-cancellation.yml b/changelogs/unreleased/pks-replicate-repository-cancellation.yml new file mode 100644 index 000000000..be729fd24 --- /dev/null +++ b/changelogs/unreleased/pks-replicate-repository-cancellation.yml @@ -0,0 +1,5 @@ +--- +title: 'repository: Fix ReplicateRepository returning before RPCs have finished' +merge_request: 3011 +author: +type: fixed diff --git a/internal/gitaly/service/repository/replicate.go b/internal/gitaly/service/repository/replicate.go index fd0b09de2..20d3ffa74 100644 --- a/internal/gitaly/service/repository/replicate.go +++ b/internal/gitaly/service/repository/replicate.go @@ -47,7 +47,13 @@ func (s *server) ReplicateRepository(ctx context.Context, in *gitalypb.Replicate } } - g, ctx := errgroup.WithContext(ctx) + // We're not using the context of the errgroup here, as an error + // returned by either of the called functions would cancel the + // respective other function. Given that we're doing RPC calls in + // them, cancellation of the calls would mean that the remote side + // may still modify the repository even though the local side has + // returned already. + g, _ := errgroup.WithContext(ctx) outgoingCtx := helper.IncomingToOutgoing(ctx) syncFuncs := []func(context.Context, *gitalypb.ReplicateRepositoryRequest) error{ |