diff options
author | Sami Hiltunen <shiltunen@gitlab.com> | 2021-03-01 18:12:42 +0300 |
---|---|---|
committer | Sami Hiltunen <shiltunen@gitlab.com> | 2021-03-04 10:31:44 +0300 |
commit | 6ebed7c911f76cb156c90ac0b8cc224aebb1699e (patch) | |
tree | 648925692c58c514b328d6032b2b8974d1e2c8d9 /internal/praefect/router_per_repository.go | |
parent | b80a3627a4e4e2e481141f61a2f151a566f45833 (diff) |
respect reads distribution feature flag in PerRepositoryRouter
PerRepositoryRouter does not currently take the reads distribution
feature flag into account. As we are getting ready to use the router
in production, this commit adds the feature flag check in the router.
Diffstat (limited to 'internal/praefect/router_per_repository.go')
-rw-r--r-- | internal/praefect/router_per_repository.go | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/internal/praefect/router_per_repository.go b/internal/praefect/router_per_repository.go index eabf4fa61..5deb8745c 100644 --- a/internal/praefect/router_per_repository.go +++ b/internal/praefect/router_per_repository.go @@ -5,6 +5,7 @@ import ( "errors" "fmt" + "gitlab.com/gitlab-org/gitaly/internal/metadata/featureflag" "gitlab.com/gitlab-org/gitaly/internal/praefect/datastore" "gitlab.com/gitlab-org/gitaly/internal/praefect/nodes" "google.golang.org/grpc" @@ -138,7 +139,7 @@ func (r *PerRepositoryRouter) RouteRepositoryAccessor(ctx context.Context, virtu return RouterNode{}, err } - if forcePrimary { + if forcePrimary || featureflag.IsDisabled(ctx, featureflag.DistributedReads) { primary, err := r.pg.GetPrimary(ctx, virtualStorage, relativePath) if err != nil { return RouterNode{}, fmt.Errorf("get primary: %w", err) |