Merge commit '0d7340380cf3094335d8bc67f7c465e2b154566a' into glitch-soc/merge-upstream

Conflicts:
- app/controllers/application_controller.rb:
  Upstream added an `include` where we had an extra `include` due to
  glitch-soc's theming system.
  Added upstream's new `include`.
This commit is contained in:
Claire
2023-07-13 13:35:15 +02:00
37 changed files with 320 additions and 185 deletions

View File

@@ -2,9 +2,10 @@
class FeedInsertWorker
include Sidekiq::Worker
include DatabaseHelper
def perform(status_id, id, type = 'home', options = {})
ApplicationRecord.connected_to(role: :primary) do
with_primary do
@type = type.to_sym
@status = Status.find(status_id)
@options = options.symbolize_keys
@@ -20,7 +21,7 @@ class FeedInsertWorker
end
end
ApplicationRecord.connected_to(role: :read, prevent_writes: true) do
with_read_replica do
check_and_insert
end
rescue ActiveRecord::RecordNotFound

View File

@@ -3,14 +3,15 @@
class MergeWorker
include Sidekiq::Worker
include Redisable
include DatabaseHelper
def perform(from_account_id, into_account_id)
ApplicationRecord.connected_to(role: :primary) do
with_primary do
@from_account = Account.find(from_account_id)
@into_account = Account.find(into_account_id)
end
ApplicationRecord.connected_to(role: :read, prevent_writes: true) do
with_read_replica do
FeedManager.instance.merge_into_home(@from_account, @into_account)
end
rescue ActiveRecord::RecordNotFound

View File

@@ -2,15 +2,16 @@
class RegenerationWorker
include Sidekiq::Worker
include DatabaseHelper
sidekiq_options lock: :until_executed
def perform(account_id, _ = :home)
ApplicationRecord.connected_to(role: :primary) do
with_primary do
@account = Account.find(account_id)
end
ApplicationRecord.connected_to(role: :read, prevent_writes: true) do
with_read_replica do
PrecomputeFeedService.new.call(@account)
end
rescue ActiveRecord::RecordNotFound

View File

@@ -2,16 +2,17 @@
class UnmergeWorker
include Sidekiq::Worker
include DatabaseHelper
sidekiq_options queue: 'pull'
def perform(from_account_id, into_account_id)
ApplicationRecord.connected_to(role: :primary) do
with_primary do
@from_account = Account.find(from_account_id)
@into_account = Account.find(into_account_id)
end
ApplicationRecord.connected_to(role: :read, prevent_writes: true) do
with_read_replica do
FeedManager.instance.unmerge_from_home(@from_account, @into_account)
end
rescue ActiveRecord::RecordNotFound