1
0
Fork 0
mirror of https://github.com/Radarr/Radarr synced 2024-12-27 10:19:41 +00:00

analytics will not leak exceptions while in production.

This commit is contained in:
kay.one 2012-01-26 22:10:15 -08:00
parent 14ed804025
commit b58fe89ce4

View file

@ -1,5 +1,7 @@
using System.Linq;
using System;
using System.Linq;
using DeskMetrics;
using NLog;
using Ninject;
using NzbDrone.Common;
@ -7,6 +9,8 @@ namespace NzbDrone.Core.Providers
{
public class AnalyticsProvider
{
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
private readonly IDeskMetricsClient _deskMetricsClient;
public const string DESKMETRICS_TEST_ID = "4ea8d347a14ad71442000002";
public const string DESKMETRICS_PRODUCTION_ID = "4f20b01ea14ad729b2000000";
@ -24,17 +28,27 @@ public AnalyticsProvider()
public virtual void Checkpoint()
{
if (EnviromentProvider.IsNewInstall)
try
{
_deskMetricsClient.RegisterInstall();
}
if (EnviromentProvider.IsNewInstall)
{
_deskMetricsClient.RegisterInstall();
}
if (_deskMetricsClient.Started)
if (_deskMetricsClient.Started)
{
_deskMetricsClient.Stop();
}
_deskMetricsClient.Start();
}
catch (Exception e)
{
_deskMetricsClient.Stop();
}
if (!EnviromentProvider.IsProduction)
throw;
_deskMetricsClient.Start();
logger.WarnException("Error while sending analytics data.", e);
}
}
}
}