Skip to content

Commit a151dd8

Browse files
DYN-6140: Fix ADP logging hang (#15560)
Co-authored-by: Bogdan Zavu <[email protected]>
1 parent 46988c1 commit a151dd8

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

src/DynamoCore/Configuration/PreferenceSettings.cs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ public class PreferenceSettings : NotificationObject, IPreferences, IRenderPreci
2828
private bool isBackgroundGridVisible;
2929
private bool disableTrustWarnings = false;
3030
private bool isNotificationCenterEnabled;
31+
private bool isADPChecked = false;
32+
private bool isADPOptedIn = false;
33+
3134
#region Constants
3235
/// <summary>
3336
/// Indicates the maximum number of files shown in Recent Files
@@ -77,12 +80,23 @@ public class PreferenceSettings : NotificationObject, IPreferences, IRenderPreci
7780

7881
/// <summary>
7982
/// Indicates whether ADP analytics reporting is approved or not.
83+
/// Note that this property is called often and the inner call to IsADPOptinIn can be slow sometimes
84+
/// especially when there is an error involved. And therefore we will only check this once per instance.
8085
/// </summary>
8186
[XmlIgnore]
8287
[Obsolete("Setter is obsolete - ADP consent should not be set directly, it should be set using the consent dialog.")]
8388
public bool IsADPAnalyticsReportingApproved
8489
{
85-
get { return Logging.AnalyticsService.IsADPOptedIn; }
90+
get
91+
{
92+
if (!isADPChecked)
93+
{
94+
isADPChecked = true;
95+
isADPOptedIn = AnalyticsService.IsADPOptedIn;
96+
}
97+
98+
return isADPOptedIn;
99+
}
86100
set { throw new Exception("do not use"); }
87101
}
88102
#endregion

src/DynamoCore/Logging/AnalyticsService.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using Dynamo.Graph.Workspaces;
1+
using Dynamo.Graph.Workspaces;
22
using Dynamo.Models;
33
using Analytics.NET.ADP;
44
using Autodesk.Analytics.Core;
@@ -66,7 +66,7 @@ internal static bool IsADPOptedIn
6666
{
6767
return false;
6868
}
69-
return adpAnalyticsUI.IsOptedIn(150,200);
69+
return adpAnalyticsUI.IsOptedIn(5,500);
7070
}
7171

7272
set
@@ -121,4 +121,4 @@ internal static string GetUserIDForSession()
121121
return null;
122122
}
123123
}
124-
}
124+
}

0 commit comments

Comments
 (0)