From 0cbe36c048c1acac1a7b03b0468bf44d88d9425f Mon Sep 17 00:00:00 2001 From: "nicolas.dorier" Date: Sun, 28 Oct 2018 21:19:18 +0900 Subject: [PATCH] Run reliable tests, remove the docker build --- .circleci/config.yml | 3 ++- BTCPayServer/Hosting/BTCPayServerServices.cs | 7 +++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index f93639625..8e3483b3e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -5,7 +5,6 @@ jobs: docker_layer_caching: true steps: - checkout - - run: docker build . test: machine: true steps: @@ -20,6 +19,8 @@ jobs: sudo apt-get install dotnet-sdk-2.1 cd BTCPayServer.Tests dotnet test --filter Fast=Fast + docker-compose up -d + dotnet test --filter Reliable=Reliable workflows: version: 2 build_and_test: diff --git a/BTCPayServer/Hosting/BTCPayServerServices.cs b/BTCPayServer/Hosting/BTCPayServerServices.cs index c8b246cb4..d8be48b88 100644 --- a/BTCPayServer/Hosting/BTCPayServerServices.cs +++ b/BTCPayServer/Hosting/BTCPayServerServices.cs @@ -43,6 +43,7 @@ using BTCPayServer.Security; using Microsoft.AspNetCore.Mvc.ModelBinding; using NBXplorer.DerivationStrategy; using NicolasDorier.RateLimits; +using Npgsql; namespace BTCPayServer.Hosting { @@ -200,7 +201,7 @@ namespace BTCPayServer.Hosting static void Retry(Action act) { - CancellationTokenSource cts = new CancellationTokenSource(10000); + CancellationTokenSource cts = new CancellationTokenSource(1000); while (true) { try @@ -208,7 +209,9 @@ namespace BTCPayServer.Hosting act(); return; } - catch when(!cts.IsCancellationRequested) + // Starting up + catch (PostgresException ex) when (ex.SqlState == "57P03") { Thread.Sleep(1000); } + catch when (!cts.IsCancellationRequested) { Thread.Sleep(100); }