From 700e18052230b6fc1b11d62bd74bc2be5776ae67 Mon Sep 17 00:00:00 2001 From: Shannon Date: Fri, 7 Aug 2015 00:02:35 +0200 Subject: [PATCH] Updates ensuring db connection so that it's not waiting arbitrarily to exit. --- src/Umbraco.Core/CoreBootManager.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Umbraco.Core/CoreBootManager.cs b/src/Umbraco.Core/CoreBootManager.cs index 80f5a14662..b4e3d06273 100644 --- a/src/Umbraco.Core/CoreBootManager.cs +++ b/src/Umbraco.Core/CoreBootManager.cs @@ -380,14 +380,19 @@ namespace Umbraco.Core if (ApplicationContext.IsConfigured == false) return; if (ApplicationContext.DatabaseContext.IsDatabaseConfigured == false) return; + //try now + if (ApplicationContext.DatabaseContext.CanConnect) + return; + var currentTry = 0; while (currentTry < 5) { + //first wait, then retry + Thread.Sleep(1000); + if (ApplicationContext.DatabaseContext.CanConnect) break; - //wait and retry - Thread.Sleep(1000); currentTry++; } @@ -395,7 +400,6 @@ namespace Umbraco.Core { throw new UmbracoStartupFailedException("Umbraco cannot start. A connection string is configured but the Umbraco cannot connect to the database."); } - } ///