diff --git a/src/DynamoPackages/PackageManagerClient.cs b/src/DynamoPackages/PackageManagerClient.cs index e2b156e118a..a93ec3058f8 100644 --- a/src/DynamoPackages/PackageManagerClient.cs +++ b/src/DynamoPackages/PackageManagerClient.cs @@ -14,6 +14,7 @@ public class PackageManagerClient #region Properties/Fields public const string PackageEngineName = "dynamo"; + private IEnumerable cachedHosts; // These were used early on in order to identify packages with binaries and python scripts // This is now a bona fide field in the DB so they are obsolete. @@ -179,12 +180,16 @@ internal virtual PackageVersion GetPackageVersionHeader(string id, string versio /// internal virtual IEnumerable GetKnownHosts() { - return FailFunc.TryExecute(() => + if (cachedHosts == null) { - var hosts = new Hosts(); - var hostsResponse = this.client.ExecuteAndDeserializeWithContent>(hosts); - return hostsResponse.content; - }, new List()); + cachedHosts = FailFunc.TryExecute(() => + { + var hosts = new Hosts(); + var hostsResponse = this.client.ExecuteAndDeserializeWithContent>(hosts); + return hostsResponse.content; + }, new List()); + } + return cachedHosts; } internal bool GetTermsOfUseAcceptanceStatus() diff --git a/src/DynamoPackages/PackageManagerExtension.cs b/src/DynamoPackages/PackageManagerExtension.cs index 6d7deca8d5a..d51021faa1f 100644 --- a/src/DynamoPackages/PackageManagerExtension.cs +++ b/src/DynamoPackages/PackageManagerExtension.cs @@ -1,9 +1,7 @@ -using System; +using System; using System.Collections.Generic; -using System.Configuration; using System.Linq; using System.Reflection; -using Dynamo.Configuration; using Dynamo.Extensions; using Dynamo.Graph.Workspaces; using Dynamo.Interfaces; @@ -357,7 +355,8 @@ internal bool CheckIfPackagesTargetOtherHosts(IEnumerable newPac { // Is our host in the list? // If not, is any other host in the list? - return x.host_dependencies != null && !x.host_dependencies.Contains(Host) && otherHosts.Any(y => x.host_dependencies.Contains(y)); + // Also, check if any dependency contains the hostname or vice-versa. + return x.host_dependencies != null && !x.host_dependencies.Contains(Host) && !x.host_dependencies.Any(y => Host.Contains(y)) && otherHosts.Any(y => x.host_dependencies.Contains(y)); }); }