Skip to content

Commit 4cdbea8

Browse files
committed
Incorporate code review changes - complete TODOs and remove unneeded key creation
1 parent 900db22 commit 4cdbea8

3 files changed

Lines changed: 147 additions & 129 deletions

File tree

src/code/FindHelper.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1289,7 +1289,6 @@ private PSResourceInfo FindDependencyWithSpecificVersion(
12891289
ConcurrentQueue<string> operationVerboseMsgs = new ConcurrentQueue<string>();
12901290

12911291
// Call FindVersionAsync() for dependency with specific version.
1292-
string key = $"{dep.Name}|{dep.VersionRange.MaxVersion.ToString()}|{_type}";
12931292
responses = currentServer.FindVersionAsync(dep.Name, dep.VersionRange.MaxVersion.ToString(), _type, operationErrorMsgs, operationWarningMsgs, operationDebugMsgs, operationVerboseMsgs).GetAwaiter().GetResult();
12941293

12951294
while (operationErrorMsgs.TryDequeue(out ErrorRecord queuedError))
@@ -1344,7 +1343,7 @@ private PSResourceInfo FindDependencyWithSpecificVersion(
13441343

13451344
string pkgVersion = FormatPkgVersionString(depPkg);
13461345
debugMsgs.Enqueue($"Found dependency '{depPkg.Name}' version '{pkgVersion}'");
1347-
key = $"{depPkg.Name}{pkgVersion}";
1346+
string key = $"{depPkg.Name}{pkgVersion}";
13481347
if (!depPkgsFound.ContainsKey(key))
13491348
{
13501349
// Add pkg to collection of packages found then find dependencies

src/code/V2ServerAPICalls.cs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1074,7 +1074,6 @@ private string HttpRequestCall(string requestUrlV2, out ErrorRecord errRecord)
10741074
/// </summary>
10751075
private async Task<string> HttpRequestCallAsync(string requestUrlV2, ConcurrentQueue<ErrorRecord> errorMsgs, ConcurrentQueue<string> warningMsgs, ConcurrentQueue<string> debugMsgs, ConcurrentQueue<string> verboseMsgs)
10761076
{
1077-
// TODO: Async methods cannot have out ref, so currently handling errorRecords as thrown exceptions.
10781077
debugMsgs.Enqueue("In V2ServerAPICalls::HttpRequestCallAsync()");
10791078
string response = string.Empty;
10801079

@@ -1131,7 +1130,6 @@ private async Task<string> HttpRequestCallAsync(string requestUrlV2, ConcurrentQ
11311130
/// </summary>
11321131
private async Task<HttpContent> HttpRequestCallForContentAsync(string requestUrlV2, ConcurrentQueue<ErrorRecord> errorMsgs, ConcurrentQueue<string> warningMsgs, ConcurrentQueue<string> debugMsgs, ConcurrentQueue<string> verboseMsgs)
11331132
{
1134-
// TODO: Async methods cannot have out ref, so need to handle errorRecords a different way.
11351133
debugMsgs.Enqueue("In V2ServerAPICalls::HttpRequestCallForContentAsync()");
11361134
HttpContent content = null;
11371135

@@ -1744,13 +1742,7 @@ public override async Task<FindResults> FindVersionGlobbingAsync(string packageN
17441742
debugMsgs.Enqueue($"Count is '{count}'");
17451743
// skip 100
17461744
skip += 100;
1747-
// TODO: this should be an async method
1748-
var tmpResponse = FindVersionGlobbing(packageName, versionRange, includePrerelease, type, skip, getOnlyLatest, out ErrorRecord errRecord);
1749-
if (errRecord != null)
1750-
{
1751-
Utils.EnqueueIfNotNull(errorMsgs, errRecord);
1752-
return new FindResults(stringResponse: Utils.EmptyStrArray, hashtableResponse: emptyHashResponses, responseType: v2FindResponseType);
1753-
}
1745+
var tmpResponse = await FindVersionGlobbingAsync(packageName, versionRange, includePrerelease, type, skip, getOnlyLatest, errorMsgs, warningMsgs, debugMsgs, verboseMsgs);
17541746
responses.Add(tmpResponse);
17551747
count--;
17561748
}

0 commit comments

Comments
 (0)