Adds catch-retry to geth info extractor

This commit is contained in:
benbierens 2023-04-17 11:28:07 +02:00
parent 8880ddd2bd
commit ca822c508d
No known key found for this signature in database
GPG Key ID: FE44815D96D0A1AA
1 changed files with 13 additions and 1 deletions

View File

@ -40,7 +40,7 @@ namespace DistTestCore.Marketplace
private string Retry(Func<string> fetch) private string Retry(Func<string> fetch)
{ {
var result = fetch(); var result = Catch(fetch);
if (string.IsNullOrEmpty(result)) if (string.IsNullOrEmpty(result))
{ {
Thread.Sleep(TimeSpan.FromSeconds(5)); Thread.Sleep(TimeSpan.FromSeconds(5));
@ -49,6 +49,18 @@ namespace DistTestCore.Marketplace
return result; return result;
} }
private string Catch(Func<string> fetch)
{
try
{
return fetch();
}
catch
{
return string.Empty;
}
}
private string FetchGenesisJson() private string FetchGenesisJson()
{ {
return workflow.ExecuteCommand(container, "cat", GethContainerRecipe.GenesisFilename); return workflow.ExecuteCommand(container, "cat", GethContainerRecipe.GenesisFilename);