From 160c5fd1fa953c41d868bee414d1068c1722f7b5 Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Thu, 6 Aug 2026 12:35:02 +1000 Subject: [PATCH] [idd] scheduler: fold late forces into cadence Treat a forced publication as periodic once the normal pre-deadline send point is due. This prevents an immediate forced copy from being followed by another copy for the same cadence slot. --- idd/LGIdd/CFrameScheduler.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/idd/LGIdd/CFrameScheduler.cpp b/idd/LGIdd/CFrameScheduler.cpp index e5c9fb66..a44340d1 100644 --- a/idd/LGIdd/CFrameScheduler.cpp +++ b/idd/LGIdd/CFrameScheduler.cpp @@ -495,27 +495,28 @@ bool CFrameScheduler::GetPublishTarget(uint64_t now, uint64_t& target, schedule = m_schedule; republish = m_republishNext; + const uint64_t safety = + max(MIN_SAFETY_NS, m_workEstimate / 8); + const uint64_t lead = + m_schedule.targetSlack + m_workEstimate + safety; + const uint64_t periodicTarget = m_nextDeadline > lead ? + m_nextDeadline - lead : now; + if (m_forceNext) { - periodic = m_nextDeadline <= now; + periodic = periodicTarget <= now; ReleaseSRWLockExclusive(&m_lock); return true; } periodic = true; - if (m_nextDeadline <= now) + if (periodicTarget <= now) { ReleaseSRWLockExclusive(&m_lock); return true; } - const uint64_t safety = - max(MIN_SAFETY_NS, m_workEstimate / 8); - const uint64_t lead = - m_schedule.targetSlack + m_workEstimate + safety; - target = m_nextDeadline > lead ? m_nextDeadline - lead : now; - if (target < now) - target = now; + target = periodicTarget; ReleaseSRWLockExclusive(&m_lock); return true; }