Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#8009] Update model invalidate cache callbacks #8011

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/models/info_request_event.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class InfoRequestEvent < ApplicationRecord
self.event_type = "hide"
end
after_create :update_request, if: :response?
after_create :invalidate_cached_pages
after_create :invalidate_cached_pages, unless: :no_xapian_reindex

after_commit -> { info_request.create_or_update_request_summary },
on: [:create]
Expand Down
3 changes: 2 additions & 1 deletion app/models/public_body.rb
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ def self.admin_title

after_save :update_missing_email_tag

after_update :reindex_requested_from, :invalidate_cached_pages
after_update :reindex_requested_from, :invalidate_cached_pages,
unless: :no_xapian_reindex

# Every public body except for the internal admin one is visible
scope :visible, -> { where("public_bodies.id <> #{ PublicBody.internal_admin_body.id }") }
Expand Down
8 changes: 4 additions & 4 deletions app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,10 @@ class User < ApplicationRecord
validate :email_and_name_are_valid

after_initialize :set_defaults
after_update :reindex_referencing_models,
:update_pro_account,
:invalidate_cached_pages

after_update :update_pro_account
after_update :reindex_referencing_models, :invalidate_cached_pages,
unless: :no_xapian_reindex

acts_as_xapian texts: [:name, :about_me],
values: [
Expand Down Expand Up @@ -330,7 +331,6 @@ def variety

# requested_by: and commented_by: search queries also need updating after save
def reindex_referencing_models
return if no_xapian_reindex == true
return unless saved_change_to_attribute?(:url_name)

expire_comments
Expand Down
2 changes: 2 additions & 0 deletions doc/CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Highlighted Features

* Improve background job performance by limiting the number `NotifyCacheJob`
jobs created (Graeme Porteous)
* Signpost key user administration contributions for requests on request list
pages (Gareth Rees)
* Signpost users to find new contact details for requests with delivery errors
Expand Down