This commit is contained in:
mr 2024-11-12 11:01:47 +01:00
parent 7fd44a55cb
commit bc79d54284
2 changed files with 8 additions and 0 deletions

View File

@ -18,6 +18,7 @@ const (
STARTED STARTED
FAILURE FAILURE
SUCCESS SUCCESS
FORGOTTEN
) )
var str = [...]string{ var str = [...]string{
@ -25,6 +26,7 @@ var str = [...]string{
"started", "started",
"failure", "failure",
"success", "success",
"forgotten",
} }
func FromInt(i int) string { func FromInt(i int) string {

View File

@ -1,6 +1,8 @@
package workflow_execution package workflow_execution
import ( import (
"time"
"cloud.o-forge.io/core/oc-lib/dbs" "cloud.o-forge.io/core/oc-lib/dbs"
"cloud.o-forge.io/core/oc-lib/dbs/mongo" "cloud.o-forge.io/core/oc-lib/dbs/mongo"
"cloud.o-forge.io/core/oc-lib/models/utils" "cloud.o-forge.io/core/oc-lib/models/utils"
@ -38,6 +40,10 @@ func (wfa *workflowExecutionMongoAccessor) LoadOne(id string) (utils.DBObject, i
return nil, code, err return nil, code, err
} }
res_mongo.Decode(&workflow) res_mongo.Decode(&workflow)
if workflow.State == int64(SCHEDULED) && time.Now().UTC().After(*workflow.ExecDate) {
workflow.State = int64(FORGOTTEN)
wfa.UpdateOne(&workflow, id)
}
return &workflow, 200, nil return &workflow, 200, nil
} }