Merge commit '71db616fed
' into kb_migration
This commit is contained in:
commit
f18fa97f0c
607 changed files with 3491 additions and 2677 deletions
|
@ -2,21 +2,26 @@
|
|||
|
||||
class FeedInsertWorker
|
||||
include Sidekiq::Worker
|
||||
include DatabaseHelper
|
||||
|
||||
def perform(status_id, id, type = 'home', options = {})
|
||||
@type = type.to_sym
|
||||
@status = Status.find(status_id)
|
||||
@options = options.symbolize_keys
|
||||
with_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
|
||||
case @type
|
||||
when :home, :tags
|
||||
@follower = Account.find(id)
|
||||
when :list
|
||||
@list = List.find(id)
|
||||
@follower = @list.account
|
||||
end
|
||||
end
|
||||
|
||||
check_and_insert
|
||||
with_read_replica do
|
||||
check_and_insert
|
||||
end
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
true
|
||||
end
|
||||
|
|
|
@ -3,9 +3,17 @@
|
|||
class MergeWorker
|
||||
include Sidekiq::Worker
|
||||
include Redisable
|
||||
include DatabaseHelper
|
||||
|
||||
def perform(from_account_id, into_account_id)
|
||||
FeedManager.instance.merge_into_home(Account.find(from_account_id), Account.find(into_account_id))
|
||||
with_primary do
|
||||
@from_account = Account.find(from_account_id)
|
||||
@into_account = Account.find(into_account_id)
|
||||
end
|
||||
|
||||
with_read_replica do
|
||||
FeedManager.instance.merge_into_home(@from_account, @into_account)
|
||||
end
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
true
|
||||
ensure
|
||||
|
|
|
@ -2,12 +2,18 @@
|
|||
|
||||
class RegenerationWorker
|
||||
include Sidekiq::Worker
|
||||
include DatabaseHelper
|
||||
|
||||
sidekiq_options lock: :until_executed
|
||||
|
||||
def perform(account_id, _ = :home)
|
||||
account = Account.find(account_id)
|
||||
PrecomputeFeedService.new.call(account)
|
||||
with_primary do
|
||||
@account = Account.find(account_id)
|
||||
end
|
||||
|
||||
with_read_replica do
|
||||
PrecomputeFeedService.new.call(@account)
|
||||
end
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
true
|
||||
end
|
||||
|
|
|
@ -2,11 +2,19 @@
|
|||
|
||||
class UnmergeWorker
|
||||
include Sidekiq::Worker
|
||||
include DatabaseHelper
|
||||
|
||||
sidekiq_options queue: 'pull'
|
||||
|
||||
def perform(from_account_id, into_account_id)
|
||||
FeedManager.instance.unmerge_from_home(Account.find(from_account_id), Account.find(into_account_id))
|
||||
with_primary do
|
||||
@from_account = Account.find(from_account_id)
|
||||
@into_account = Account.find(into_account_id)
|
||||
end
|
||||
|
||||
with_read_replica do
|
||||
FeedManager.instance.unmerge_from_home(@from_account, @into_account)
|
||||
end
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
true
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue