]> cat aescling's git repositories - mastodon.git/commitdiff
Fix FollowRecommendationsScheduler failing because of unpopulated views (#16189)
authorClaire <claire.github-309c@sitedethib.com>
Sun, 9 May 2021 08:39:29 +0000 (10:39 +0200)
committerGitHub <noreply@github.com>
Sun, 9 May 2021 08:39:29 +0000 (10:39 +0200)
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.

app/models/account_summary.rb
app/models/follow_recommendation.rb

index 6a7e17c6c1f42444f0f9578ea80a5c3173ad612f..3a3cebc55c76da27015d88ee08790333ce1dcb71 100644 (file)
@@ -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?
index 1ed6dc49b6226a99c0aa7adea71143aaeae17a10..e552b5a88d1c37009952ca9074d62755c3bc8ab3 100644 (file)
@@ -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?