diff options
author | Thibaut Girka <thib@sitedethib.com> | 2019-03-08 00:57:13 +0100 |
---|---|---|
committer | Thibaut Girka <thib@sitedethib.com> | 2019-03-08 00:57:13 +0100 |
commit | 5528719bc9fd4e8dca0e5e51de183a6dd27b4d55 (patch) | |
tree | 30e615140e1afbe8d7d8986fe4743d1e4aeb7a03 /app/services/activitypub | |
parent | 38e9c66f34d7054357a3de63834f182734d43d75 (diff) | |
parent | 3aaac4f134eb092baeb0ba5979bdb3abd702a4ee (diff) |
Merge branch 'master' into glitch-soc/merge-upstream
Diffstat (limited to 'app/services/activitypub')
-rw-r--r-- | app/services/activitypub/fetch_remote_poll_service.rb | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/app/services/activitypub/fetch_remote_poll_service.rb b/app/services/activitypub/fetch_remote_poll_service.rb index 1dd587d73..4f9814fcd 100644 --- a/app/services/activitypub/fetch_remote_poll_service.rb +++ b/app/services/activitypub/fetch_remote_poll_service.rb @@ -32,12 +32,17 @@ class ActivityPub::FetchRemotePollService < BaseService # votes, so we need to remove them poll.votes.delete_all if latest_options != poll.options - poll.update!( - last_fetched_at: Time.now.utc, - expires_at: expires_at, - options: latest_options, - cached_tallies: items.map { |item| item.dig('replies', 'totalItems') || 0 } - ) + begin + poll.update!( + last_fetched_at: Time.now.utc, + expires_at: expires_at, + options: latest_options, + cached_tallies: items.map { |item| item.dig('replies', 'totalItems') || 0 } + ) + rescue ActiveRecord::StaleObjectError + poll.reload + retry + end end private |