prep
This commit is contained in:
@@ -6,6 +6,8 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"oc-schedulerd/conf"
|
||||
|
||||
oclib "cloud.o-forge.io/core/oc-lib"
|
||||
"cloud.o-forge.io/core/oc-lib/dbs"
|
||||
"cloud.o-forge.io/core/oc-lib/models/common/enum"
|
||||
@@ -122,14 +124,14 @@ func (s *ScheduleManager) ExecuteWorkflow(resp tools.NATSResponse) {
|
||||
|
||||
func (s *ScheduleManager) GetNextScheduledWorkflows(_ tools.NATSResponse) {
|
||||
start := time.Now().UTC()
|
||||
fmt.Println(s.getExecution(
|
||||
start.Add(time.Second*time.Duration(-1)).UTC(),
|
||||
start.Add(time.Minute*time.Duration(1)).UTC(),
|
||||
))
|
||||
if next_wf_exec, err := s.getExecution(
|
||||
start.Add(time.Second*time.Duration(-1)).UTC(),
|
||||
start.Add(time.Minute*time.Duration(1)).UTC(),
|
||||
); err != nil {
|
||||
// Fetch executions whose scheduled start falls within the next
|
||||
// (PrepLeadSeconds + 60s) window, so they are loaded in time to
|
||||
// trigger oc-monitord PrepLeadSeconds before the actual start.
|
||||
horizon := time.Duration(conf.GetConfig().PrepLeadSeconds+60) * time.Second
|
||||
from := start.Add(-time.Second)
|
||||
to := start.Add(horizon)
|
||||
fmt.Println(s.getExecution(from, to))
|
||||
if next_wf_exec, err := s.getExecution(from, to); err != nil {
|
||||
s.Logger.Error().Msg("Could not retrieve next schedules")
|
||||
} else {
|
||||
Executions.AddSchedules(next_wf_exec, s.Logger)
|
||||
|
||||
Reference in New Issue
Block a user