casual debug, time added before change of state bookin & exec
This commit is contained in:
@@ -60,11 +60,13 @@ func (wfa *workflowExecutionMongoAccessor) CopyOne(data utils.DBObject) (utils.D
|
||||
|
||||
func (a *workflowExecutionMongoAccessor) LoadOne(id string) (utils.DBObject, int, error) {
|
||||
return utils.GenericLoadOne[*WorkflowExecution](id, func(d utils.DBObject) (utils.DBObject, int, error) {
|
||||
if d.(*WorkflowExecution).State == enum.DRAFT && !a.shallow && time.Now().UTC().After(d.(*WorkflowExecution).ExecDate) {
|
||||
now := time.Now()
|
||||
now = now.Add(time.Second * 60)
|
||||
if d.(*WorkflowExecution).State == enum.DRAFT && !a.shallow && now.UTC().After(d.(*WorkflowExecution).ExecDate) {
|
||||
utils.GenericDeleteOne(d.GetID(), newShallowAccessor(a.Request))
|
||||
return nil, 404, errors.New("not found")
|
||||
}
|
||||
if d.(*WorkflowExecution).State == enum.SCHEDULED && !a.shallow && time.Now().UTC().After(d.(*WorkflowExecution).ExecDate) {
|
||||
if d.(*WorkflowExecution).State == enum.SCHEDULED && !a.shallow && now.UTC().After(d.(*WorkflowExecution).ExecDate) {
|
||||
d.(*WorkflowExecution).State = enum.FORGOTTEN
|
||||
utils.GenericRawUpdateOne(d, id, newShallowAccessor(a.Request))
|
||||
}
|
||||
@@ -82,11 +84,13 @@ func (a *workflowExecutionMongoAccessor) Search(filters *dbs.Filters, search str
|
||||
|
||||
func (a *workflowExecutionMongoAccessor) getExec() func(utils.DBObject) utils.ShallowDBObject {
|
||||
return func(d utils.DBObject) utils.ShallowDBObject {
|
||||
if d.(*WorkflowExecution).State == enum.DRAFT && time.Now().UTC().After(d.(*WorkflowExecution).ExecDate) {
|
||||
now := time.Now()
|
||||
now = now.Add(time.Second * 60)
|
||||
if d.(*WorkflowExecution).State == enum.DRAFT && now.UTC().After(d.(*WorkflowExecution).ExecDate) {
|
||||
utils.GenericDeleteOne(d.GetID(), newShallowAccessor(a.Request))
|
||||
return nil
|
||||
}
|
||||
if d.(*WorkflowExecution).State == enum.SCHEDULED && time.Now().UTC().After(d.(*WorkflowExecution).ExecDate) {
|
||||
if d.(*WorkflowExecution).State == enum.SCHEDULED && now.UTC().After(d.(*WorkflowExecution).ExecDate) {
|
||||
d.(*WorkflowExecution).State = enum.FORGOTTEN
|
||||
utils.GenericRawUpdateOne(d, d.GetID(), newShallowAccessor(a.Request))
|
||||
return d
|
||||
|
Reference in New Issue
Block a user