Skip to content

Commit e3d4222

Browse files
committed
Merge branch 'develop' of https://github.com/PCJones/UmlautAdaptarr into develop
2 parents ed044e9 + 5463794 commit e3d4222

File tree

2 files changed

+31
-32
lines changed

2 files changed

+31
-32
lines changed

UmlautAdaptarr/Utilities/ServicesExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ private static async Task<WebApplicationBuilder> AddServicesWithOptions<TOptions
6868
Console.WriteLine(($"Property {failure.PropertyName } failed validation. Error was: {failure.ErrorMessage}"));
6969
}
7070

71-
throw new Exception("Please fix your environment variables and then Start UmlautAdaptarr again");
71+
throw new Exception("Please fix cour environment variables and then Start UmlautAdaptarr again");
7272
}
7373

7474
var instanceState = (bool)(typeof(TOptions).GetProperty("Enabled")?.GetValue(option, null) ?? false);

UmlautAdaptarr/Validator/GlobalInstanceOptionsValidator.cs

Lines changed: 30 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -36,37 +36,36 @@ private bool BeAValidUrl(string url)
3636
&& (uriResult.Scheme == Uri.UriSchemeHttp || uriResult.Scheme == Uri.UriSchemeHttps);
3737
}
3838

39-
private static async Task<bool> BeReachable(GlobalInstanceOptions opts, CancellationToken cancellationToken)
40-
{
41-
var endTime = DateTime.Now.AddMinutes(3);
42-
var reachable = false;
43-
var url = $"{opts.Host}/api?apikey={opts.ApiKey}";
44-
45-
while (DateTime.Now < endTime)
46-
{
47-
try
48-
{
49-
using var response = await httpClient.GetAsync(url, cancellationToken);
50-
if (response.IsSuccessStatusCode)
51-
{
52-
reachable = true;
53-
break;
54-
}
55-
else
56-
{
57-
Console.WriteLine($"Reachable check got unexpected status code {response.StatusCode}.");
58-
}
59-
}
60-
catch (Exception ex)
61-
{
62-
Console.WriteLine(ex.Message);
63-
}
39+
private static async Task<bool> BeReachable(GlobalInstanceOptions opts, CancellationToken cancellationToken)
40+
{
41+
var endTime = DateTime.Now.AddMinutes(3);
42+
var reachable = false;
43+
var url = $"{opts.Host}/api?apikey={opts.ApiKey}";
6444

65-
// Wait for 15 seconds for next try
66-
Console.WriteLine($"The URL \"{opts.Host}/api?apikey=[REDACTED]\" is not reachable. Next attempt in 15 seconds...");
67-
Thread.Sleep(15000);
68-
}
45+
while (DateTime.Now < endTime)
46+
{
47+
try
48+
{
49+
using var response = await httpClient.GetAsync(url, cancellationToken);
50+
if (response.IsSuccessStatusCode)
51+
{
52+
reachable = true;
53+
break;
54+
}
55+
else
56+
{
57+
Console.WriteLine($"Reachable check got unexpected status code {response.StatusCode}.");
58+
}
59+
}
60+
catch (Exception ex)
61+
{
62+
Console.WriteLine(ex.Message);
63+
}
6964

70-
return reachable;
71-
}
65+
// Wait for 15 seconds for next try
66+
Console.WriteLine($"The URL \"{opts.Host}/api?apikey=[REDACTED]\" is not reachable. Next attempt in 15 seconds...");
67+
Thread.Sleep(15000);
68+
}
69+
70+
return reachable;
7271
}

0 commit comments

Comments
 (0)