Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize callbacks by using solr instead of find_collections_by_type #6925

Merged
merged 1 commit into from
Oct 16, 2024

Conversation

cjcolvar
Copy link
Member

@cjcolvar cjcolvar commented Oct 15, 2024

The ensure_no_collections and ensure_no_settings_changes_if_collections_exist have guards which return early if any collections exist for the given collection type. It appears that the existing approach fetches all of the collection objects before testing with .any?. For the fedora adapter (and possibly other adapters) this will lead to reading all of the objects in the repository before filtering for collection model objects (see https://github.com/samvera/hyrax/blob/main/app/services/hyrax/custom_queries/find_collections_by_type.rb#L31 and https://github.com/samvera/valkyrie/blob/main/lib/valkyrie/persistence/fedora/query_service.rb#L82). To avoid that we can search solr for a count of collections and test it is greater than 0.

Resolves #6888

@samvera/hyrax-code-reviewers

Copy link

github-actions bot commented Oct 15, 2024

Test Results

    17 files  +    1      17 suites  +1   2h 17m 26s ⏱️ + 16m 36s
 6 714 tests +  355   6 417 ✅ +203  297 💤 +152  0 ❌ ±0 
13 198 runs  +1 075  12 802 ✅ +888  396 💤 +187  0 ❌ ±0 

Results for commit 8a4172d. ± Comparison against base commit 0ffde70.

This pull request removes 178 and adds 533 tests. Note that renamed tests count towards both.
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplate:0x00007f5fca4ed848>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplate:0x00007f676a23e118>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplateAccess:0x00007f5fca25f8d8>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplateAccess:0x00007f676b1480c8>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to destroy AdminSet: ca06651c-5c4b-45c7-8d3b-be7a5f734dc4
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to destroy Hyrax::AdministrativeSet: 354cdcac-cec7-41ec-973a-e267bf634b3f
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to edit AdminSet: a4f4f896-d0a9-4e0f-a026-f31a44278e7f
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to edit Hyrax::AdministrativeSet: 62716f21-bfc4-4f2c-a143-02f66f0fb16a
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to update AdminSet: dc8d6361-b251-43f2-8572-8cfecc33c273
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to update Hyrax::AdministrativeSet: dbcde030-67fd-4706-9711-951d16360622
…
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplate:0x00007fcb36e135d0>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplate:0x00007fea181d8e90>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplateAccess:0x00007fcb36d83480>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplateAccess:0x00007fea181ab7d8>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to destroy AdminSet: 70ffe11f-c2c1-4889-8c04-64d73ca1088a
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to destroy Hyrax::AdministrativeSet: e13011e2-e529-4e7a-861f-81747d13cdab
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to edit AdminSet: 002b1b6f-b4cf-4197-ab02-19c0ab69908c
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to edit Hyrax::AdministrativeSet: 56c6eb3e-6160-4bef-882e-f30c3578793b
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to update AdminSet: 8aeefda0-3442-4eff-9471-1381eb683671
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to update Hyrax::AdministrativeSet: 639693ed-8b89-40d6-bf21-a73654baa8fc
…

♻️ This comment has been updated with latest results.

@dlpierce dlpierce merged commit 13b6c9e into main Oct 16, 2024
22 checks passed
@dlpierce dlpierce deleted the ct_opt branch October 16, 2024 15:02
@dlpierce dlpierce added the notes-minor Release Notes: Non-breaking features label Oct 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
notes-minor Release Notes: Non-breaking features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Creating, modifying or deleting a collection type in Sirenia takes a really long time
2 participants