Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
pinzart committed Nov 28, 2023
1 parent a05f9a1 commit c78c1a7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
5 changes: 3 additions & 2 deletions src/DynamoUtilities/CLIWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ protected static string GetToolPath(string relativePath)
/// </summary>
/// <param name="timeoutms">will return empty string if we don't finish reading all data in the timeout provided in milliseconds.</param>
/// <returns></returns>
protected virtual async Task<string> GetData(int timeoutms)
protected virtual string GetData(int timeoutms)
{
var readStdOutTask = Task.Run(() =>
{
Expand Down Expand Up @@ -145,7 +145,8 @@ protected virtual async Task<string> GetData(int timeoutms)
return writer.ToString();
}
});
var completedTask = await Task.WhenAny(readStdOutTask, Task.Delay(TimeSpan.FromMilliseconds(timeoutms)));

var completedTask = Task.WhenAny(readStdOutTask, Task.Delay(TimeSpan.FromMilliseconds(timeoutms))).Result;
//if the completed task was our read std out task, then return the data
//else we timed out, so return an empty string.
return completedTask == readStdOutTask ? readStdOutTask.Result : string.Empty;
Expand Down
2 changes: 1 addition & 1 deletion src/DynamoUtilities/DynamoFeatureFlagsManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ internal void CacheAllFlags()
{

//wait for response
var dataFromCLI = GetData(featureFlagTimeoutMs).Result;
var dataFromCLI = GetData(featureFlagTimeoutMs);
//convert from json string to dictionary.
try
{
Expand Down
6 changes: 2 additions & 4 deletions src/DynamoUtilities/Md2Html.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,7 @@ internal string ParseMd2Html(string mdString, string mdPath)
return GetCantCommunicateErrorMessage();
}

var output = GetData(processCommunicationTimeoutms);

return output.Result;
return GetData(processCommunicationTimeoutms);
}

/// <summary>
Expand Down Expand Up @@ -104,7 +102,7 @@ internal string SanitizeHtml(string content)

var output = GetData(processCommunicationTimeoutms);

return output.Result;
return output;
}

/// <summary>
Expand Down

0 comments on commit c78c1a7

Please sign in to comment.