diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-19 12:08:42 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-19 12:08:42 +0300 |
commit | b76ae638462ab0f673e5915986070518dd3f9ad3 (patch) | |
tree | bdab0533383b52873be0ec0eb4d3c66598ff8b91 /lib/gitlab/markdown_cache | |
parent | 434373eabe7b4be9593d18a585fb763f1e5f1a6f (diff) |
Add latest changes from gitlab-org/gitlab@14-2-stable-eev14.2.0-rc42
Diffstat (limited to 'lib/gitlab/markdown_cache')
-rw-r--r-- | lib/gitlab/markdown_cache/active_record/extension.rb | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/gitlab/markdown_cache/active_record/extension.rb b/lib/gitlab/markdown_cache/active_record/extension.rb index 1de890c84f9..e21268c5fff 100644 --- a/lib/gitlab/markdown_cache/active_record/extension.rb +++ b/lib/gitlab/markdown_cache/active_record/extension.rb @@ -10,7 +10,9 @@ module Gitlab # Using before_update here conflicts with elasticsearch-model somehow before_create :refresh_markdown_cache, if: :invalidated_markdown_cache? before_update :refresh_markdown_cache, if: :invalidated_markdown_cache? - after_save :store_mentions!, if: :mentionable_attributes_changed? + # The import case needs to be fixed to avoid large number of + # SQL queries: https://gitlab.com/gitlab-org/gitlab/-/issues/21801 + after_save :store_mentions!, if: :mentionable_attributes_changed?, unless: ->(obj) { obj.is_a?(Importable) && obj.importing? } end # Always exclude _html fields from attributes (including serialization). @@ -37,6 +39,7 @@ module Gitlab def save_markdown(updates) return unless persisted? && Gitlab::Database.read_write? + return if cached_markdown_version.to_i < cached_markdown_version_in_database.to_i update_columns(updates) end |