Merge commit '41a505513fb36f7c28c8d8a4270d5ee192169462' into glitch-soc/merge-upstream
Conflicts: - `app/serializers/initial_state_serializer.rb`: Upstream renamed an initial state parameter, where we had extra ones. Renamed as upstream did. - `app/workers/feed_insert_worker.rb`: Upstream wrapped database query in a block, we had extra database queries because of the DM timeline. Moved everything in the block.
This commit is contained in:
@ -4,21 +4,25 @@ class FeedInsertWorker
|
||||
include Sidekiq::Worker
|
||||
|
||||
def perform(status_id, id, type = 'home', options = {})
|
||||
@type = type.to_sym
|
||||
@status = Status.find(status_id)
|
||||
@options = options.symbolize_keys
|
||||
ApplicationRecord.connected_to(role: :primary) do
|
||||
@type = type.to_sym
|
||||
@status = Status.find(status_id)
|
||||
@options = options.symbolize_keys
|
||||
|
||||
case @type
|
||||
when :home, :tags
|
||||
@follower = Account.find(id)
|
||||
when :list
|
||||
@list = List.find(id)
|
||||
@follower = @list.account
|
||||
when :direct
|
||||
@account = Account.find(id)
|
||||
case @type
|
||||
when :home, :tags
|
||||
@follower = Account.find(id)
|
||||
when :list
|
||||
@list = List.find(id)
|
||||
@follower = @list.account
|
||||
when :direct
|
||||
@account = Account.find(id)
|
||||
end
|
||||
end
|
||||
|
||||
check_and_insert
|
||||
ApplicationRecord.connected_to(role: :read, prevent_writes: true) do
|
||||
check_and_insert
|
||||
end
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
true
|
||||
end
|
||||
|
Reference in New Issue
Block a user