diff options
author | Claire <claire.github-309c@sitedethib.com> | 2021-02-03 18:57:38 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-03 18:57:38 +0100 |
commit | 4ed9576cd28abc033a094fed6babe9825014f1af (patch) | |
tree | d6d5e7b07e24248da5c237726dca874727c10b38 /app/lib/activitypub/activity/move.rb | |
parent | 7632255115a7f6e6f9f8047f0d0d1b90d7ee9315 (diff) | |
parent | e1fa06c459a28a575d0da540432c61b702e99cdd (diff) |
Merge pull request #1496 from ClearlyClaire/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'app/lib/activitypub/activity/move.rb')
-rw-r--r-- | app/lib/activitypub/activity/move.rb | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/app/lib/activitypub/activity/move.rb b/app/lib/activitypub/activity/move.rb index 7e073f64d..8576ceccd 100644 --- a/app/lib/activitypub/activity/move.rb +++ b/app/lib/activitypub/activity/move.rb @@ -4,9 +4,8 @@ class ActivityPub::Activity::Move < ActivityPub::Activity PROCESSING_COOLDOWN = 7.days.seconds def perform - return if origin_account.uri != object_uri || processed? - - mark_as_processing! + return if origin_account.uri != object_uri + return unless mark_as_processing! target_account = ActivityPub::FetchRemoteAccountService.new.call(target_uri) @@ -35,12 +34,8 @@ class ActivityPub::Activity::Move < ActivityPub::Activity value_or_id(@json['target']) end - def processed? - redis.exists?("move_in_progress:#{@account.id}") - end - def mark_as_processing! - redis.setex("move_in_progress:#{@account.id}", PROCESSING_COOLDOWN, true) + redis.set("move_in_progress:#{@account.id}", true, nx: true, ex: PROCESSING_COOLDOWN) end def unmark_as_processing! |