Skip to content

Commit

Permalink
[OCC] if synchronous, reset non-pending (sei-protocol#477)
Browse files Browse the repository at this point in the history
## 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
  • Loading branch information
stevenlanders authored and maoueh committed Mar 29, 2024
1 parent 92e6425 commit 263f52f
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions tasks/scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 263f52f

Please sign in to comment.