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] remove redundant fetching of profile devices and certificates #21409

Merged
merged 2 commits into from Oct 31, 2023

Conversation

nekrich
Copy link
Contributor

@nekrich nekrich commented Jul 18, 2023

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 see several green ci/circleci builds in the "All checks have passed" section of my PR (connect CircleCI to GitHub if not)
  • I've read the Contribution Guidelines
  • I've updated the documentation if necessary.

Motivation and Context

match is slow when running in edit mode. I found out that when the match checks device count and development certificates validity. match downloads a provisioning profile from the portal with devices and certificates payload and additionally sends two more requests to the portal to fetch devices and certificates once again. There is no need to fetch remote info twice.

Description

Changes allow match to use devices & certificates info from the first request from the received provisioning profile. As a result, the are 2x decrease in requests sent to App Store Connect API when checking if the provisioning profile must be updated.

Testing Steps

run match.

@nekrich
Copy link
Contributor Author

nekrich commented Aug 18, 2023

@rogerluan , can you please look at this PR?

Copy link
Member

@rogerluan rogerluan left a comment

Choose a reason for hiding this comment

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

I also thought we had to fetch them again initially, but after reviewing the code better, this makes total sense to me!

However, since this is a critical part of match, I'll leave it for @joshdholtz to review it whenever he has some time, since he's the one who implemented this originally 🙇

@rogerluan
Copy link
Member

Really nice catch btw @nekrich ! Thanks for this PR! 🙌

@nekrich
Copy link
Contributor Author

nekrich commented Sep 22, 2023

Waited so long, and missed release. @joshdholtz , please review 🙏

@getaaron
Copy link
Collaborator

getaaron commented Oct 7, 2023

@nekrich @rogerluan one question before I merge, why does profile.rb have attr_accessor :certificates but not attr_accessor :devices? Should we add it for devices?

@rogerluan
Copy link
Member

That's a really good question @getaaron 🤔 after analyzing the code it looks like it was just forgotten? Because it even has an entry in attr_mapping.

From code review alone it looks like this code would even crash due to lack of devices accessor, idk how this is actually working in real-life tests (in the unit test is understandable why it works, since we're mocking the accessor…).

Could you confirm whether that's the expected behavior or if there's an accessor missing, @nekrich ?

@nekrich
Copy link
Contributor Author

nekrich commented Oct 9, 2023

@rogerluan Looks likes it's missing 🤔.

@nekrich
Copy link
Contributor Author

nekrich commented Oct 9, 2023

Added the accessor, waiting for tests.

@nekrich
Copy link
Contributor Author

nekrich commented Oct 9, 2023

Some tests failed, but I don't see any relationship with the changes I've made 🤔.

@rogerluan
Copy link
Member

CI seems to have broke due to CircleCI's deprecation:

image

I'm taking a look at this now

@rogerluan
Copy link
Member

Oh, this PR just needs rebasing from master @nekrich, would you do that for us? 🙏

@nekrich
Copy link
Contributor Author

nekrich commented Oct 18, 2023

@rogerluan , @getaaron, sorry for the delay. I've just rebased my branch 🤞.

@rogerluan
Copy link
Member

CI was failing, I just triggered it again to see if it was a flaky test.

Copy link
Collaborator

@getaaron getaaron left a comment

Choose a reason for hiding this comment

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

Tests look good. Thanks for the PR!

@getaaron getaaron merged commit 34a1635 into fastlane:master Oct 31, 2023
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants