mirror of
https://github.com/kikobar/mastodon.git
synced 2024-11-17 04:32:22 +00:00
Fix Performance/Count cop (#24793)
This commit is contained in:
parent
9189e90ff2
commit
bae694108a
|
@ -308,12 +308,6 @@ Performance/CollectionLiteralInLoop:
|
||||||
- 'config/deploy.rb'
|
- 'config/deploy.rb'
|
||||||
- 'lib/mastodon/media_cli.rb'
|
- 'lib/mastodon/media_cli.rb'
|
||||||
|
|
||||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
||||||
Performance/Count:
|
|
||||||
Exclude:
|
|
||||||
- 'app/lib/importer/accounts_index_importer.rb'
|
|
||||||
- 'app/lib/importer/tags_index_importer.rb'
|
|
||||||
|
|
||||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||||
# Configuration parameters: SafeMultiline.
|
# Configuration parameters: SafeMultiline.
|
||||||
Performance/DeletePrefix:
|
Performance/DeletePrefix:
|
||||||
|
|
|
@ -6,8 +6,8 @@ class Importer::AccountsIndexImporter < Importer::BaseImporter
|
||||||
in_work_unit(tmp) do |accounts|
|
in_work_unit(tmp) do |accounts|
|
||||||
bulk = Chewy::Index::Import::BulkBuilder.new(index, to_index: accounts).bulk_body
|
bulk = Chewy::Index::Import::BulkBuilder.new(index, to_index: accounts).bulk_body
|
||||||
|
|
||||||
indexed = bulk.select { |entry| entry[:index] }.size
|
indexed = bulk.count { |entry| entry[:index] }
|
||||||
deleted = bulk.select { |entry| entry[:delete] }.size
|
deleted = bulk.count { |entry| entry[:delete] }
|
||||||
|
|
||||||
Chewy::Index::Import::BulkRequest.new(index).perform(bulk)
|
Chewy::Index::Import::BulkRequest.new(index).perform(bulk)
|
||||||
|
|
||||||
|
|
|
@ -6,8 +6,8 @@ class Importer::TagsIndexImporter < Importer::BaseImporter
|
||||||
in_work_unit(tmp) do |tags|
|
in_work_unit(tmp) do |tags|
|
||||||
bulk = Chewy::Index::Import::BulkBuilder.new(index, to_index: tags).bulk_body
|
bulk = Chewy::Index::Import::BulkBuilder.new(index, to_index: tags).bulk_body
|
||||||
|
|
||||||
indexed = bulk.select { |entry| entry[:index] }.size
|
indexed = bulk.count { |entry| entry[:index] }
|
||||||
deleted = bulk.select { |entry| entry[:delete] }.size
|
deleted = bulk.count { |entry| entry[:delete] }
|
||||||
|
|
||||||
Chewy::Index::Import::BulkRequest.new(index).perform(bulk)
|
Chewy::Index::Import::BulkRequest.new(index).perform(bulk)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue