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
diff options
context:
space:
mode:
authorSami Hiltunen <shiltunen@gitlab.com>2022-06-29 13:40:56 +0300
committerSami Hiltunen <shiltunen@gitlab.com>2022-06-29 13:40:56 +0300
commit5ec432da21f12c51e239ab00959026130bea059c (patch)
tree6714b6d4df891dc06ea570652e2e4830645e3551
parent06b6a8078f62fea99194b830894116dfcdaab745 (diff)
parent82d240016dd37cd95b04e7ccfd04f808dec2a70e (diff)
Merge branch 'xx/keep-ctx-suppression-logic-consistent' into 'master'
Keep context cancel suppression logic consistent See merge request gitlab-org/gitaly!4656
-rw-r--r--doc/design_pack_objects_cache.md2
-rw-r--r--internal/gitaly/service/hook/pack_objects.go16
2 files changed, 2 insertions, 16 deletions
diff --git a/doc/design_pack_objects_cache.md b/doc/design_pack_objects_cache.md
index a44a67679..fca4c9e46 100644
--- a/doc/design_pack_objects_cache.md
+++ b/doc/design_pack_objects_cache.md
@@ -34,7 +34,7 @@ The whole pack-objects cache path depends on
option. When upload-pack would run git pack-objects to create a packfile for a
client, it will run `gitaly-hooks` binary instead. The arguments when calling
`gitaly-hooks` includes `git pack-objects` at the beginning. This pattern is
-similar to how Gitaly handles Git hooks during a push (such as `pre-preceive`
+similar to how Gitaly handles Git hooks during a push (such as `pre-receive`
and `post-receive`).
## Problem scope
diff --git a/internal/gitaly/service/hook/pack_objects.go b/internal/gitaly/service/hook/pack_objects.go
index ba7170989..f71db9d2c 100644
--- a/internal/gitaly/service/hook/pack_objects.go
+++ b/internal/gitaly/service/hook/pack_objects.go
@@ -105,20 +105,6 @@ func (s *server) packObjectsHook(ctx context.Context, repo *gitalypb.Repository,
return r.Wait(ctx)
}
-type contextWithoutCancel struct {
- context.Context
- valueCtx context.Context
-}
-
-func (cwc *contextWithoutCancel) Value(key interface{}) interface{} { return cwc.valueCtx.Value(key) }
-
-func cloneContextValues(ctx context.Context) context.Context {
- return &contextWithoutCancel{
- Context: context.Background(),
- valueCtx: ctx,
- }
-}
-
func (s *server) runPackObjects(ctx context.Context, w io.Writer, repo *gitalypb.Repository, args *packObjectsArgs, stdin io.ReadCloser, key string) error {
// We want to keep the context for logging, but we want to block all its
// cancelation signals (deadline, cancel etc.). This is because of
@@ -131,7 +117,7 @@ func (s *server) runPackObjects(ctx context.Context, w io.Writer, repo *gitalypb
// If the cancelation of client1 propagated into the runPackObjects
// goroutine this would affect client2. We don't want that. So to prevent
// that, we suppress the cancelation of the originating context.
- ctx = cloneContextValues(ctx)
+ ctx = helper.SuppressCancellation(ctx)
ctx, cancel := context.WithCancel(ctx)
defer cancel()