Plugins - Added retry system when auto-enabling features

This commit is contained in:
Robert committed 2021-07-24 20:42:33 +02:00
1 parent 66b1620441
commit 9179010e12
2 files changed
+39 -7

No files matched your search

+7 -1
View File
@@ -12,7 +12,7 @@ namespace Artemis.Core
{
private bool _isEnabled;
/// <summary>
/// Gets the plugin feature info related to this feature
/// </summary>
@@ -37,6 +37,8 @@ namespace Artemis.Core
internal set => SetAndNotify(ref _isEnabled, value);
}
internal int AutoEnableAttempts { get; set; }
/// <summary>
/// Gets the identifier of this plugin feature
/// </summary>
@@ -137,6 +139,9 @@ namespace Artemis.Core
try
{
if (isAutoEnable)
AutoEnableAttempts++;
if (isAutoEnable && GetLockFileCreated())
{
// Don't wrap existing lock exceptions, simply rethrow them
@@ -157,6 +162,7 @@ namespace Artemis.Core
throw new ArtemisPluginException(Plugin, "Plugin load timeout");
Info.LoadException = null;
AutoEnableAttempts = 0;
OnEnabled();
}
// If enable failed, put it back in a disabled state