Refactor opportunity: allow cross slot commands in all Gitlab::Redis::ClusterUtil methods
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
Referencing !159542 (comment 2014931413). We could probably call Gitlab::Instrumentation::RedisClusterValidator.allow_cross_slot_commands
inside ::Gitlab::Redis::ClusterUtil
by default to simplify the caller's job.
- Hints on lines of code which may need changing
All usages of Rails.cache.delete_multi
or .fetch_multi
or .read_multi
can be cleaned up to not need Gitlab::Instrumentation::RedisClusterValidator.allow_cross_slot_commands
.
The allow_cross_slot_commands
can be moved into methods in https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/redis/cluster_util.rb.
Files to look at (ignore docs):
➜ gitlab git:(master) ✗ rg 'Rails.cache.(fetch|delete|read)_multi'
lib/banzai/renderer.rb
65: # Rails.cache.read_multi operation. If the Markdown String is not in the cache
113: items_in_cache = Rails.cache.read_multi(*cacheable_items.map { |item| item[:cache_key] })
181: # To map Rails.cache.read_multi results we need to know the Rails.cache.expanded_key.
changelogs/archive.md
3851: - ObjectRenderer retrieve renderer content using Rails.cache.read_multi
ee/app/services/gitlab_subscriptions/add_on_purchases/reconcile_seat_overage_service.rb
37: Rails.cache.delete_multi(cache_keys)
ee/app/models/gitlab_subscriptions/add_on_purchase.rb
91: Rails.cache.delete_multi(cache_keys)
ee/app/models/ee/user.rb
286: Rails.cache.delete_multi(cache_keys)
app/services/projects/batch_count_service.rb
17: Rails.cache.fetch_multi(*services_by_cache_key.keys) do |key|
app/models/namespace.rb
874: Rails.cache.delete_multi(keys)
Related docs:
Edited by 🤖 GitLab Bot 🤖