0
0
Fork 0

Change materialized views to be refreshed concurrently to avoid locks (#29015)

This commit is contained in:
Eugen Rochko 2024-01-30 19:21:30 +01:00 committed by GitHub
parent c4af668e5c
commit fa0ba67753
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 11 additions and 7 deletions

View file

@ -19,6 +19,8 @@ class AccountSummary < ApplicationRecord
scope :filtered, -> { where.missing(:follow_recommendation_suppressions) }
def self.refresh
Scenic.database.refresh_materialized_view(table_name, concurrently: true, cascade: false)
rescue ActiveRecord::StatementInvalid
Scenic.database.refresh_materialized_view(table_name, concurrently: false, cascade: false)
end