From ca822c508d69077d5b54555816bb237dcd16dbdc Mon Sep 17 00:00:00 2001 From: benbierens Date: Mon, 17 Apr 2023 11:28:07 +0200 Subject: [PATCH] Adds catch-retry to geth info extractor --- DistTestCore/Marketplace/GethInfoExtractor.cs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/DistTestCore/Marketplace/GethInfoExtractor.cs b/DistTestCore/Marketplace/GethInfoExtractor.cs index 59725ec..7151a60 100644 --- a/DistTestCore/Marketplace/GethInfoExtractor.cs +++ b/DistTestCore/Marketplace/GethInfoExtractor.cs @@ -40,7 +40,7 @@ namespace DistTestCore.Marketplace private string Retry(Func fetch) { - var result = fetch(); + var result = Catch(fetch); if (string.IsNullOrEmpty(result)) { Thread.Sleep(TimeSpan.FromSeconds(5)); @@ -49,6 +49,18 @@ namespace DistTestCore.Marketplace return result; } + private string Catch(Func fetch) + { + try + { + return fetch(); + } + catch + { + return string.Empty; + } + } + private string FetchGenesisJson() { return workflow.ExecuteCommand(container, "cat", GethContainerRecipe.GenesisFilename);