Optimize map { ... }.compact calls (#15513)
* Optimize map { ... }.compact using Enumerable#filter_map, supported since Ruby 2.7 * Add poyfill for Enumerable#filter_map
This commit is contained in:
parent
9395143126
commit
087ed84367
22 changed files with 52 additions and 26 deletions
|
@ -14,7 +14,7 @@ class ActivityPub::SynchronizeFollowersService < BaseService
|
|||
# should never happen in practice, since in almost all cases we keep an
|
||||
# Account record, and should we not do that, we should have sent a Delete.
|
||||
# In any case there is not much we can do if that occurs.
|
||||
@expected_followers = items.map { |uri| ActivityPub::TagManager.instance.uri_to_resource(uri, Account) }.compact
|
||||
@expected_followers = items.filter_map { |uri| ActivityPub::TagManager.instance.uri_to_resource(uri, Account) }
|
||||
|
||||
remove_unexpected_local_followers!
|
||||
handle_unexpected_outgoing_follows!
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue