WaitSiteIsOperational should only wait full sync

This commit is contained in:
nicolas.dorier 2020-03-10 17:24:38 +09:00
parent e6acc19bcc
commit 2e630ac5d8
No known key found for this signature in database
GPG Key ID: 6618763EF09186FE

View File

@ -231,23 +231,13 @@ namespace BTCPayServer.Tests
private async Task WaitSiteIsOperational()
{
_ = HttpClient.GetAsync("/").ConfigureAwait(false);
using (var cts = new CancellationTokenSource(20_000))
{
var synching = WaitIsFullySynched(cts.Token);
var accessingHomepage = WaitCanAccessHomepage(cts.Token);
await Task.WhenAll(synching, accessingHomepage).ConfigureAwait(false);
}
}
private async Task WaitCanAccessHomepage(CancellationToken cancellationToken)
{
while (true)
{
var resp = await HttpClient.GetAsync("/", cancellationToken).ConfigureAwait(false);
if (resp.StatusCode == HttpStatusCode.OK)
break;
await Task.Delay(10, cancellationToken).ConfigureAwait(false);
await Task.WhenAll(synching).ConfigureAwait(false);
}
// Opportunistic call to wake up view compilation in debug mode, we don't need to await.
}
private async Task WaitIsFullySynched(CancellationToken cancellationToken)