Skip to content

Commit bb61a0f

Browse files
committed
Allow user to specify a startup interval as well as a limit on min interval frequency
1 parent 8aa7c5d commit bb61a0f

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

Source/Shared/Plugins/Default/1020_UpdateConfigurationSettingsWhileIdlePlugin.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,13 @@ public class UpdateConfigurationSettingsWhileIdlePlugin : IEventPlugin, IDisposa
1616
/// </summary>
1717
/// <param name="configuration">The configuration.</param>
1818
/// <param name="interval">The interval at which the client will automatically ensure the configuration settings are up-to-date when idle.</param>
19-
public UpdateConfigurationSettingsWhileIdlePlugin(ExceptionlessConfiguration configuration, TimeSpan? interval = null) {
19+
/// <param name="startupInterval">The amount of time after the plugin is initialized that the settings should be updated. This will default to 5 seconds. If an event is submitted before this time than configuration will be updated after the specified interval.</param>
20+
public UpdateConfigurationSettingsWhileIdlePlugin(ExceptionlessConfiguration configuration, TimeSpan? interval = null, TimeSpan? startupInterval = null) {
2021
_configuration = configuration;
2122

22-
var startupInterval = interval ?? TimeSpan.FromSeconds(5);
23-
_interval = interval.HasValue && interval.Value.Ticks > 0 ? interval.Value : TimeSpan.FromMinutes(5);
24-
_timer = new Timer(UpdateConfiguration, null, startupInterval, _interval);
23+
startupInterval = startupInterval.HasValue && startupInterval.Value.Ticks >= 0 ? startupInterval.Value : TimeSpan.FromSeconds(5);
24+
_interval = interval.HasValue && interval.Value.Ticks >= TimeSpan.TicksPerMinute ? interval.Value : TimeSpan.FromMinutes(5);
25+
_timer = new Timer(UpdateConfiguration, null, startupInterval.Value, _interval);
2526
}
2627

2728
public void Run(EventPluginContext context) {

0 commit comments

Comments
 (0)