Switch to SQL Server

This commit is contained in:
2019-07-28 09:50:43 -04:00
parent 339a88dab0
commit d60924049d
7 changed files with 62 additions and 63 deletions

View File

@@ -55,7 +55,8 @@ namespace ChrisKaczor.HomeMonitor.Weather.Service
_queueModel.BasicConsume(_configuration["Weather:Queue:Name"], true, consumer);
_hubConnection = new HubConnectionBuilder().WithUrl(_configuration["Hub:Weather"]).Build();
if (!string.IsNullOrEmpty(_configuration["Hub:Weather"]))
_hubConnection = new HubConnectionBuilder().WithUrl(_configuration["Hub:Weather"]).Build();
return Task.CompletedTask;
}
@@ -64,7 +65,7 @@ namespace ChrisKaczor.HomeMonitor.Weather.Service
{
WriteLog("MessageHandler: Stop");
_hubConnection.StopAsync(cancellationToken).Wait(cancellationToken);
_hubConnection?.StopAsync(cancellationToken).Wait(cancellationToken);
_queueModel.Close();
_queueConnection.Close();
@@ -100,6 +101,9 @@ namespace ChrisKaczor.HomeMonitor.Weather.Service
_database.StoreWeatherData(weatherMessage);
if (_hubConnection == null)
return;
try
{
if (_hubConnection.State == HubConnectionState.Disconnected)