mirror of
https://github.com/Radarr/Radarr
synced 2024-12-26 17:59:14 +00:00
analytics will not leak exceptions while in production.
This commit is contained in:
parent
14ed804025
commit
b58fe89ce4
1 changed files with 23 additions and 9 deletions
|
@ -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)
|
||||
{
|
||||
_deskMetricsClient.Stop();
|
||||
if (_deskMetricsClient.Started)
|
||||
{
|
||||
_deskMetricsClient.Stop();
|
||||
}
|
||||
|
||||
_deskMetricsClient.Start();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
if (!EnviromentProvider.IsProduction)
|
||||
throw;
|
||||
|
||||
logger.WarnException("Error while sending analytics data.", e);
|
||||
}
|
||||
|
||||
_deskMetricsClient.Start();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue