Commit ca664282 authored by Kamil Trzciński's avatar Kamil Trzciński

Merge branch 'geo_use_memoization_for_container_repository_client' into 'master'

Add missing memoization for ContainerRepository client

See merge request gitlab-org/gitlab!18019
parents fcfc9c68 5d90de1f
......@@ -5,6 +5,7 @@ require 'tempfile'
module Geo
class ContainerRepositorySync
include ExclusiveLeaseGuard
include Gitlab::Utils::StrongMemoize
LEASE_TIMEOUT = 1.hour.freeze
......@@ -96,10 +97,12 @@ module Geo
# The client for primary registry
def client
ContainerRegistry::Client.new(
Gitlab.config.geo.registry_replication.primary_api_url,
token: ::Auth::ContainerRegistryAuthenticationService.pull_access_token(name)
)
strong_memoize(:client) do
ContainerRegistry::Client.new(
Gitlab.config.geo.registry_replication.primary_api_url,
token: ::Auth::ContainerRegistryAuthenticationService.pull_access_token(name)
)
end
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment