소스 검색

Ensure SynchronizeFeaturedCollectionWorker is unique and clean up (#7043)

* Ensure SynchronizeFeaturedCollectionWorker is unique and clean up

Fix #7041

* Fix code style issue
master
Eugen Rochko 6 년 전
committed by GitHub
부모
커밋
778562c223
No known key found for this signature in database GPG 키 ID: 4AEE18F83AFDEB23
2개의 변경된 파일9개의 추가작업 그리고 6개의 파일을 삭제
  1. +8
    -5
      app/services/activitypub/process_account_service.rb
  2. +1
    -1
      app/workers/activitypub/synchronize_featured_collection_worker.rb

+ 8
- 5
app/services/activitypub/process_account_service.rb 파일 보기

@@ -22,13 +22,15 @@ class ActivityPub::ProcessAccountService < BaseService

create_account if @account.nil?
update_account
process_tags(@account)
process_tags
end
end

return if @account.nil?

after_protocol_change! if protocol_changed?
after_key_change! if key_changed?
check_featured_collection! if @account&.featured_collection_url&.present?
check_featured_collection! if @account.featured_collection_url.present?

@account
rescue Oj::ParseError
@@ -189,17 +191,18 @@ class ActivityPub::ProcessAccountService < BaseService
{ redis: Redis.current, key: "process_account:#{@uri}" }
end

def process_tags(account)
def process_tags
return if @json['tag'].blank?

as_array(@json['tag']).each do |tag|
case tag['type']
when 'Emoji'
process_emoji tag, account
process_emoji tag
end
end
end

def process_emoji(tag, _account)
def process_emoji(tag)
return if skip_download?
return if tag['name'].blank? || tag['icon'].blank? || tag['icon']['url'].blank?



+ 1
- 1
app/workers/activitypub/synchronize_featured_collection_worker.rb 파일 보기

@@ -3,7 +3,7 @@
class ActivityPub::SynchronizeFeaturedCollectionWorker
include Sidekiq::Worker

sidekiq_options queue: 'pull'
sidekiq_options queue: 'pull', unique: :until_executed

def perform(account_id)
ActivityPub::FetchFeaturedCollectionService.new.call(Account.find(account_id))


불러오는 중...
취소
저장