about summary refs log tree commit diff
path: root/app/workers
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2022-11-06 09:50:41 +0100
committerClaire <claire.github-309c@sitedethib.com>2022-11-06 09:50:41 +0100
commit0ad919b19257b7d8eb447f7955030927d26cdbe6 (patch)
treed78bd5ba447da166bb7d97a3df3e6d97902a5cdb /app/workers
parent2f8fb49d1314db931385089bc9004a48700161ad (diff)
parent5187e4e758b0636432d984d1a95a310cac536205 (diff)
Merge branch 'main' into glitch-soc/merge-upstream
Conflicts:
- `app/javascript/mastodon/features/compose/components/poll_form.js`:
  glitch-soc change because of having changed the default number of
  available poll options.
  Applied upstream's changes while keeping glitch-soc's default number of
  poll options.
- `public/oops.png`:
  We had a minor graphics change, probably not worth diverging from upstream.
  Took upstream version.
Diffstat (limited to 'app/workers')
-rw-r--r--app/workers/push_update_worker.rb11
-rw-r--r--app/workers/scheduler/indexing_scheduler.rb2
-rw-r--r--app/workers/scheduler/user_cleanup_scheduler.rb2
3 files changed, 10 insertions, 5 deletions
diff --git a/app/workers/push_update_worker.rb b/app/workers/push_update_worker.rb
index ae444cfde..72c781749 100644
--- a/app/workers/push_update_worker.rb
+++ b/app/workers/push_update_worker.rb
@@ -5,11 +5,12 @@ class PushUpdateWorker
   include Redisable
 
   def perform(account_id, status_id, timeline_id = nil, options = {})
-    @account     = Account.find(account_id)
     @status      = Status.find(status_id)
-    @timeline_id = timeline_id || "timeline:#{account.id}"
+    @account_id  = account_id
+    @timeline_id = timeline_id || "timeline:#{account_id}"
     @options     = options.symbolize_keys
 
+    render_payload!
     publish!
   rescue ActiveRecord::RecordNotFound
     true
@@ -17,14 +18,14 @@ class PushUpdateWorker
 
   private
 
-  def payload
-    InlineRenderer.render(@status, @account, :status)
+  def render_payload!
+    @payload = StatusCacheHydrator.new(@status).hydrate(@account_id)
   end
 
   def message
     Oj.dump(
       event: update? ? :'status.update' : :update,
-      payload: payload,
+      payload: @payload,
       queued_at: (Time.now.to_f * 1000.0).to_i
     )
   end
diff --git a/app/workers/scheduler/indexing_scheduler.rb b/app/workers/scheduler/indexing_scheduler.rb
index 3a6f47a29..c42396629 100644
--- a/app/workers/scheduler/indexing_scheduler.rb
+++ b/app/workers/scheduler/indexing_scheduler.rb
@@ -7,6 +7,8 @@ class Scheduler::IndexingScheduler
   sidekiq_options retry: 0
 
   def perform
+    return unless Chewy.enabled?
+
     indexes.each do |type|
       with_redis do |redis|
         ids = redis.smembers("chewy:queue:#{type.name}")
diff --git a/app/workers/scheduler/user_cleanup_scheduler.rb b/app/workers/scheduler/user_cleanup_scheduler.rb
index d1f00c47f..7a6995a1f 100644
--- a/app/workers/scheduler/user_cleanup_scheduler.rb
+++ b/app/workers/scheduler/user_cleanup_scheduler.rb
@@ -15,6 +15,8 @@ class Scheduler::UserCleanupScheduler
 
   def clean_unconfirmed_accounts!
     User.where('confirmed_at is NULL AND confirmation_sent_at <= ?', 2.days.ago).reorder(nil).find_in_batches do |batch|
+      # We have to do it separately because of missing database constraints
+      AccountModerationNote.where(account_id: batch.map(&:account_id)).delete_all
       Account.where(id: batch.map(&:account_id)).delete_all
       User.where(id: batch.map(&:id)).delete_all
     end