@@ -25,19 +25,18 @@ public ExceptionlessClient(string apiKey) : this(new ExceptionlessConfiguration(
25
25
}
26
26
27
27
public ExceptionlessClient ( Action < ExceptionlessConfiguration > configure ) : this ( new ExceptionlessConfiguration ( DependencyResolver . CreateDefault ( ) ) ) {
28
- if ( configure == null )
29
- return ;
30
-
31
- configure ( Configuration ) ;
32
- _updateSettingsTimer . Change ( GetInitialSettingsDelay ( ) , Configuration . UpdateSettingsWhenIdleInterval ) ;
28
+ if ( configure != null )
29
+ configure ( Configuration ) ;
33
30
}
34
31
35
32
public ExceptionlessClient ( ExceptionlessConfiguration configuration ) {
36
33
if ( configuration == null )
37
34
throw new ArgumentNullException ( "configuration" ) ;
38
35
39
36
Configuration = configuration ;
37
+ Configuration . Changed += OnConfigurationChanged ;
40
38
Configuration . Resolver . Register ( typeof ( ExceptionlessConfiguration ) , ( ) => Configuration ) ;
39
+
41
40
_log = new Lazy < IExceptionlessLog > ( ( ) => Configuration . Resolver . GetLog ( ) ) ;
42
41
_queue = new Lazy < IEventQueue > ( ( ) => {
43
42
// config can't be changed after the queue starts up.
@@ -60,7 +59,11 @@ private TimeSpan GetInitialSettingsDelay() {
60
59
private void OnQueueEventsPosted ( object sender , EventsPostedEventArgs args ) {
61
60
_updateSettingsTimer . Change ( Configuration . UpdateSettingsWhenIdleInterval , Configuration . UpdateSettingsWhenIdleInterval ) ;
62
61
}
63
-
62
+
63
+ private void OnConfigurationChanged ( object sender , EventArgs e ) {
64
+ _updateSettingsTimer . Change ( ! _queue . IsValueCreated ? GetInitialSettingsDelay ( ) : Configuration . UpdateSettingsWhenIdleInterval , Configuration . UpdateSettingsWhenIdleInterval ) ;
65
+ }
66
+
64
67
public ExceptionlessConfiguration Configuration { get ; private set ; }
65
68
66
69
/// <summary>
@@ -268,6 +271,7 @@ protected void OnSubmittedEvent(EventSubmittedEventArgs e) {
268
271
}
269
272
270
273
void IDisposable . Dispose ( ) {
274
+ Configuration . Changed -= OnConfigurationChanged ;
271
275
if ( _queue . IsValueCreated )
272
276
_queue . Value . EventsPosted -= OnQueueEventsPosted ;
273
277
0 commit comments