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

[match] add profile_type filtering when checking if profile exists #20311

Merged
merged 2 commits into from
Jun 30, 2022

Conversation

PaulTaykalo
Copy link
Contributor

@PaulTaykalo PaulTaykalo commented May 22, 2022

Checklist

  • I've run bundle exec rspec from the root directory to see all new and existing tests pass
  • I've followed the fastlane code style and run bundle exec rubocop -a to ensure the code style is valid
  • I've read the Contribution Guidelines
  • I've updated the documentation if necessary.

Motivation and Context

When match checking if profile exists on AppStore Connect, the check is relatively slow, if performed without filtering.
App Store Connect API doesn't support filtering by the profile uuid, but it supports filtering by profileType.
Adding filtering by profileType significantly speeds up requests, thatmatch is performing

https://developer.apple.com/documentation/appstoreconnectapi/list_and_download_profiles#query-parameters

It seems that response time highly depends on the amount of returned items.
It was around ~20s for 85 profiles, and ~4s for 9 profiles (with filtering).

Description

Additional filtering is added by profileType

Testing Steps

Copy link
Contributor

@lucgrabowski lucgrabowski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for optimizing fetching profiles :) This is great.

match/lib/match/spaceship_ensure.rb Outdated Show resolved Hide resolved
Comment on lines 80 to 82
# But we can filter provisioning profiles based on their type (this, in general way faster than getting all profiles)
filter = { profileType: profile_types(type).join(",") } if type
found = Spaceship::ConnectAPI::Profile.all(filter: filter).find do |profile|
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is so smart! Slightly embarrassed I didn't do this right away 🙈

match/lib/match/spaceship_ensure.rb Outdated Show resolved Hide resolved
@PaulTaykalo PaulTaykalo force-pushed the fix/add-filter-for-match branch 3 times, most recently from d25b4c2 to 7d683b2 Compare May 25, 2022 17:56
types = profile_types(prov_type)
# Filtering on 'profileType' seems to be undocumented as of 2020-07-30
# but works on both web session and official API
types = Match.profile_types(prov_type)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here. this information is actually mentioned in documentation at this moment (2022-05-22)
https://developer.apple.com/documentation/appstoreconnectapi/list_and_download_profiles#query-parameters

Copy link
Contributor

@lucgrabowski lucgrabowski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🔥 Thanks for improving performance :)

@PaulTaykalo
Copy link
Contributor Author

@joshdholtz Is there anything needed to be added?

@PaulTaykalo
Copy link
Contributor Author

bump

Copy link
Member

@joshdholtz joshdholtz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this PR! This is so so so much better 😊

@joshdholtz joshdholtz merged commit 38a316f into fastlane:master Jun 30, 2022
Copy link

@fastlane-bot fastlane-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Congratulations! 🎉 This was released as part of fastlane 2.207.0 🚀

@fastlane fastlane locked and limited conversation to collaborators Sep 1, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants