summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2021-05-09 10:39:29 +0200
committerGitHub <noreply@github.com>2021-05-09 10:39:29 +0200
commitf9c2d1b9a1c1e3f6b3d79b6d2edefe4f4f5cf2a6 (patch)
treeba486e2468a75af280113c3128d0c1c2af3e0524
parent4d31cef19db9b719540e07030e5eb6d32b20234a (diff)
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.
-rw-r--r--app/models/account_summary.rb2
-rw-r--r--app/models/follow_recommendation.rb2
2 files changed, 2 insertions, 2 deletions
diff --git a/app/models/account_summary.rb b/app/models/account_summary.rb
index 6a7e17c6c1f..3a3cebc55c7 100644
--- a/app/models/account_summary.rb
+++ b/app/models/account_summary.rb
@@ -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)) }
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
def readonly?
diff --git a/app/models/follow_recommendation.rb b/app/models/follow_recommendation.rb
index 1ed6dc49b62..e552b5a88d1 100644
--- a/app/models/follow_recommendation.rb
+++ b/app/models/follow_recommendation.rb
@@ -17,7 +17,7 @@ class FollowRecommendation < ApplicationRecord
scope :localized, ->(locale) { joins(:account_summary).merge(AccountSummary.localized(locale)) }
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
def readonly?