mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-02-15 20:54:58 +00:00
Merge branch 'feat/action-scheduler' of Common/Utils into dev
This commit is contained in:
@@ -130,7 +130,7 @@ namespace ICD.Common.Utils.Services.Scheduler
|
|||||||
m_CriticalSection.Enter();
|
m_CriticalSection.Enter();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var action = m_Actions.FirstOrDefault(a => a.NextRunTime != null);
|
var action = m_Actions.FirstOrDefault(a => a.NextRunTime != null && a.NextRunTime > IcdEnvironment.GetLocalTime());
|
||||||
if (action == null || action.NextRunTime == null)
|
if (action == null || action.NextRunTime == null)
|
||||||
{
|
{
|
||||||
m_Timer.Stop();
|
m_Timer.Stop();
|
||||||
@@ -138,6 +138,8 @@ namespace ICD.Common.Utils.Services.Scheduler
|
|||||||
}
|
}
|
||||||
|
|
||||||
long msToNextAction = (long)(action.NextRunTime.Value - IcdEnvironment.GetLocalTime()).TotalMilliseconds;
|
long msToNextAction = (long)(action.NextRunTime.Value - IcdEnvironment.GetLocalTime()).TotalMilliseconds;
|
||||||
|
if (msToNextAction < 0)
|
||||||
|
msToNextAction = 1000;
|
||||||
m_Timer.Reset(msToNextAction);
|
m_Timer.Reset(msToNextAction);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
|
|||||||
Reference in New Issue
Block a user