diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-12-20 16:37:47 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-12-20 16:37:47 +0300 |
commit | aee0a117a889461ce8ced6fcf73207fe017f1d99 (patch) | |
tree | 891d9ef189227a8445d83f35c1b0fc99573f4380 /lib/gitlab/etag_caching | |
parent | 8d46af3258650d305f53b819eabf7ab18d22f59e (diff) |
Add latest changes from gitlab-org/gitlab@14-6-stable-eev14.6.0-rc42
Diffstat (limited to 'lib/gitlab/etag_caching')
-rw-r--r-- | lib/gitlab/etag_caching/router/graphql.rb | 5 | ||||
-rw-r--r-- | lib/gitlab/etag_caching/store.rb | 12 |
2 files changed, 13 insertions, 4 deletions
diff --git a/lib/gitlab/etag_caching/router/graphql.rb b/lib/gitlab/etag_caching/router/graphql.rb index 2b8639b9411..1f56670ee7f 100644 --- a/lib/gitlab/etag_caching/router/graphql.rb +++ b/lib/gitlab/etag_caching/router/graphql.rb @@ -17,6 +17,11 @@ module Gitlab %r(\Apipelines/sha/\w{7,40}\z), 'ci_editor', 'pipeline_authoring' + ], + [ + %r(\Aon_demand_scan/counts/), + 'on_demand_scans', + 'dynamic_application_security_testing' ] ].map(&method(:build_route)).freeze diff --git a/lib/gitlab/etag_caching/store.rb b/lib/gitlab/etag_caching/store.rb index d0d790a7c72..44c6984c09b 100644 --- a/lib/gitlab/etag_caching/store.rb +++ b/lib/gitlab/etag_caching/store.rb @@ -12,14 +12,18 @@ module Gitlab Gitlab::Redis::SharedState.with { |redis| redis.get(redis_shared_state_key(key)) } end - def touch(key, only_if_missing: false) - etag = generate_etag + def touch(*keys, only_if_missing: false) + etags = keys.map { generate_etag } Gitlab::Redis::SharedState.with do |redis| - redis.set(redis_shared_state_key(key), etag, ex: EXPIRY_TIME, nx: only_if_missing) + redis.pipelined do + keys.each_with_index do |key, i| + redis.set(redis_shared_state_key(key), etags[i], ex: EXPIRY_TIME, nx: only_if_missing) + end + end end - etag + keys.size > 1 ? etags : etags.first end private |