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
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions match/lib/match/runner.rb
Expand Up @@ -337,7 +337,7 @@ def device_count_different?(profile: nil, keychain_path: nil, platform: nil, inc
portal_profile = all_profiles.detect { |i| i.uuid == uuid }

if portal_profile
profile_device_count = portal_profile.fetch_all_devices.count
profile_device_count = portal_profile.devices.count

device_classes =
case platform
Expand Down Expand Up @@ -418,7 +418,7 @@ def certificate_count_different?(profile: nil, keychain_path: nil, platform: nil
# * For portal certificates, we filter out the expired one but includes a new certificate;
# * Profile still contains an expired certificate and is valid.
# Thus, we need to check the validity of profile certificates too.
profile_certs_count = portal_profile.fetch_all_certificates.select(&:valid?).count
profile_certs_count = portal_profile.certificates.select(&:valid?).count

certificate_types =
case platform
Expand Down
2 changes: 1 addition & 1 deletion match/spec/runner_spec.rb
Expand Up @@ -292,7 +292,7 @@

before do
allow(profile).to receive(:uuid).and_return(uuid)
allow(profile).to receive(:fetch_all_devices).and_return([profile_device])
allow(profile).to receive(:devices).and_return([profile_device])
end

it "device is enabled" do
Expand Down
1 change: 1 addition & 0 deletions spaceship/lib/spaceship/connect_api/models/profile.rb
Expand Up @@ -15,6 +15,7 @@ class Profile

attr_accessor :bundle_id
attr_accessor :certificates
attr_accessor :devices

attr_mapping({
"name" => "name",
Expand Down