Skip to content
Snippets Groups Projects
Unverified Commit c3f85bc9 authored by Kamil Trzcińśki's avatar Kamil Trzcińśki Committed by Peter Leitzen
Browse files

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
parent 61c9b7f5
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -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
Loading
Loading
Loading
Loading
@@ -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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment