mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-04-12 12:07:05 +00:00
Merge branch 'feat/action-scheduler' of Common/Utils into dev
This commit is contained in:
commit
e8ce1e94cc
1 changed files with 3 additions and 1 deletions
|
|
@ -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
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue