aboutsummaryrefslogtreecommitdiffstats
path: root/core/test/scheduler.go
diff options
context:
space:
mode:
Diffstat (limited to 'core/test/scheduler.go')
-rw-r--r--core/test/scheduler.go13
1 files changed, 7 insertions, 6 deletions
diff --git a/core/test/scheduler.go b/core/test/scheduler.go
index 023d09f..6a3a40a 100644
--- a/core/test/scheduler.go
+++ b/core/test/scheduler.go
@@ -165,12 +165,6 @@ func (sch *Scheduler) workerRoutine(wg *sync.WaitGroup) {
if sch.stopper.ShouldStop(e.ValidatorID) {
sch.cancelFunc()
}
- // Include the execution interval of parent event to the expected time
- // to execute child events.
- for _, newEvent := range newEvents {
- newEvent.ParentTime = e.Time
- newEvent.Time = newEvent.Time.Add(e.ExecInterval)
- }
return newEvents
}()
// Record executed events as history.
@@ -178,8 +172,15 @@ func (sch *Scheduler) workerRoutine(wg *sync.WaitGroup) {
sch.historyLock.Lock()
defer sch.historyLock.Unlock()
+ e.HistoryIndex = len(sch.history)
sch.history = append(sch.history, e)
}()
+ // Include the execution interval of parent event to the expected time
+ // to execute child events.
+ for _, newEvent := range newEvents {
+ newEvent.ParentHistoryIndex = e.HistoryIndex
+ newEvent.Time = newEvent.Time.Add(e.ExecInterval)
+ }
// Add derivated events back to event queue.
func() {
sch.eventsLock.Lock()