fix: add lock for threadsafety

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
Andrew Welker
2025-04-11 13:26:01 -05:00
committed by GitHub
parent 59baa74dd7
commit 60550caf99

View File

@@ -201,12 +201,15 @@ namespace PepperDash.Essentials.Core
private void BeginPolling()
{
if(PollTimer != null)
lock (_pollTimerLock)
{
return;
}
if (PollTimer != null)
{
return;
}
PollTimer = new Timer(o => Poll(), null, 0, PollTime);
PollTimer = new Timer(o => Poll(), null, 0, PollTime);
}
}
/// <summary>