From 263f52f9fdeb5724fc163b41bc89f7db90c1c0d4 Mon Sep 17 00:00:00 2001 From: Steven Landers Date: Fri, 29 Mar 2024 13:29:15 -0400 Subject: [PATCH] [OCC] if synchronous, reset non-pending (#477) ## Describe your changes and provide context - Some tasks could be in waiting states, and this ensure those have been reset/incremented ## Testing performed to validate your change - Unit tests --- tasks/scheduler.go | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/tasks/scheduler.go b/tasks/scheduler.go index 9980658e6..2a40ee4f2 100644 --- a/tasks/scheduler.go +++ b/tasks/scheduler.go @@ -533,14 +533,21 @@ func (s *scheduler) executeTask(task *deliverTxTask) { task.Ctx = dCtx // in the synchronous case, we only want to re-execute tasks that need re-executing - // if already validated, then this does another validation - if s.synchronous && task.IsStatus(statusValidated) { - s.shouldRerun(task) + if s.synchronous { + // if already validated, then this does another validation if task.IsStatus(statusValidated) { - return + s.shouldRerun(task) + if task.IsStatus(statusValidated) { + return + } + } + + // waiting transactions may not yet have been reset + // this ensures a task has been reset and incremented + if !task.IsStatus(statusPending) { + task.Reset() + task.Increment() } - task.Reset() - task.Increment() } s.prepareTask(task)