changed how we store upcoming executions from slice to map
This commit is contained in:
@@ -22,11 +22,11 @@ func (em *ExecutionManager) RetrieveNextExecutions() {
|
||||
Executions.Mu.Lock()
|
||||
if len(Executions.Execs) > 0 {
|
||||
executions := Executions.Execs
|
||||
for i := len(executions) - 1; i >= 0; i-- {
|
||||
if executions[i].ExecDate.Before(time.Now().UTC()) {
|
||||
logger.Info().Msg("Will execute " + executions[i].UUID + " soon")
|
||||
go em.executeExecution(executions[i])
|
||||
Executions.Execs = append(executions[:i], executions[i+1:]...)
|
||||
for execId, exec := range executions {
|
||||
if exec.ExecDate.Before(time.Now().UTC()) {
|
||||
logger.Info().Msg("Will execute " + execId + " soon")
|
||||
go em.executeExecution(&exec)
|
||||
delete(executions,execId)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user