Fix FollowRecommendationsScheduler failing because of unpopulated views (#16189)
Since #16173, `account_summaries` and `follow_recommendations` are not populated at creation time, which causes concurrent refresh to fail. As we currently only use those materialized views right after explicitly refreshing them, this commit changes refreshes to not be performed concurrently. This will fix the issue and ensure the refresh completes faster while using less resources.
This commit is contained in:
parent
4d31cef19d
commit
f9c2d1b9a1
@ -16,7 +16,7 @@ class AccountSummary < ApplicationRecord
|
|||||||
scope :filtered, -> { joins(arel_table.join(FollowRecommendationSuppression.arel_table, Arel::Nodes::OuterJoin).on(arel_table[:account_id].eq(FollowRecommendationSuppression.arel_table[:account_id])).join_sources).where(FollowRecommendationSuppression.arel_table[:id].eq(nil)) }
|
scope :filtered, -> { joins(arel_table.join(FollowRecommendationSuppression.arel_table, Arel::Nodes::OuterJoin).on(arel_table[:account_id].eq(FollowRecommendationSuppression.arel_table[:account_id])).join_sources).where(FollowRecommendationSuppression.arel_table[:id].eq(nil)) }
|
||||||
|
|
||||||
def self.refresh
|
def self.refresh
|
||||||
Scenic.database.refresh_materialized_view(table_name, concurrently: true, cascade: false)
|
Scenic.database.refresh_materialized_view(table_name, concurrently: false, cascade: false)
|
||||||
end
|
end
|
||||||
|
|
||||||
def readonly?
|
def readonly?
|
||||||
|
@ -17,7 +17,7 @@ class FollowRecommendation < ApplicationRecord
|
|||||||
scope :localized, ->(locale) { joins(:account_summary).merge(AccountSummary.localized(locale)) }
|
scope :localized, ->(locale) { joins(:account_summary).merge(AccountSummary.localized(locale)) }
|
||||||
|
|
||||||
def self.refresh
|
def self.refresh
|
||||||
Scenic.database.refresh_materialized_view(table_name, concurrently: true, cascade: false)
|
Scenic.database.refresh_materialized_view(table_name, concurrently: false, cascade: false)
|
||||||
end
|
end
|
||||||
|
|
||||||
def readonly?
|
def readonly?
|
||||||
|
Loading…
Reference in New Issue
Block a user