[FIX] Attempted fix for #1
This commit is contained in:
parent
ba88ef438a
commit
82bbf70525
2 changed files with 17 additions and 2 deletions
|
|
@ -88,7 +88,7 @@ internal static class Internal
|
||||||
|
|
||||||
public class InternalSheduler
|
public class InternalSheduler
|
||||||
{
|
{
|
||||||
public static Dictionary<string, taskInfo> registeredScheduledTasks { get; private set; } = new Dictionary<string, taskInfo>();
|
public static Dictionary<string, taskInfo> registeredScheduledTasks { get; internal set; } = new Dictionary<string, taskInfo>();
|
||||||
|
|
||||||
public class taskInfo
|
public class taskInfo
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -255,7 +255,22 @@ public static class UniversalExtensions
|
||||||
task.Start();
|
task.Start();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (registeredScheduledTasks is null)
|
||||||
|
registeredScheduledTasks = new();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
registeredScheduledTasks.Add(UID, new taskInfo { tokenSource = CancellationToken, customId = CustomId, runTime = runTime });
|
registeredScheduledTasks.Add(UID, new taskInfo { tokenSource = CancellationToken, customId = CustomId, runTime = runTime });
|
||||||
|
}
|
||||||
|
catch (InvalidOperationException)
|
||||||
|
{
|
||||||
|
registeredScheduledTasks = new();
|
||||||
|
registeredScheduledTasks.Add(UID, new taskInfo { tokenSource = CancellationToken, customId = CustomId, runTime = runTime });
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
return UID;
|
return UID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue