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
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -200,6 +200,8 @@ namespace PepperDash.Essentials.Core
} }
private void BeginPolling() private void BeginPolling()
{
lock (_pollTimerLock)
{ {
if (PollTimer != null) if (PollTimer != null)
{ {
@ -208,6 +210,7 @@ namespace PepperDash.Essentials.Core
PollTimer = new Timer(o => Poll(), null, 0, PollTime); PollTimer = new Timer(o => Poll(), null, 0, PollTime);
} }
}
/// <summary> /// <summary>
/// Stop the poll cycle /// Stop the poll cycle