提交 3448f221 编写于 作者: K Kamil Trzciński

Merge branch 'pl-reactive-caching-primary_key' into 'master'

Enable caching for records which primary key is not `id`

See merge request gitlab-org/gitlab-ce!24245
......@@ -52,6 +52,11 @@ class SshHostKey
@compare_host_keys = compare_host_keys
end
# Needed for reactive caching
def self.primary_key
'id'
end
def id
[project.id, url].join(':')
end
......
......@@ -12,7 +12,7 @@ class ReactiveCachingWorker
end
return unless klass
klass.find_by(id: id).try(:exclusively_update_reactive_cache!, *args)
klass.find_by(klass.primary_key => id).try(:exclusively_update_reactive_cache!, *args)
end
# rubocop: enable CodeReuse/ActiveRecord
end
---
title: Enable caching for records which primary key is not `id`
merge_request: 24245
author:
type: fixed
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册