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

@ -201,12 +201,15 @@ namespace PepperDash.Essentials.Core
private void BeginPolling() 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> /// <summary>