Browse Source

En cours de développement

master
losyme 2 months ago
parent
commit
2d077fa74a
  1. 26
      internal/model/storage.go

26
internal/model/storage.go

@ -62,20 +62,35 @@ func (m *Model) storageUpdateJob(job *jw.Job) error {
return nil
}
func (m *Model) logWorkflow(wf *jw.Workflow) {
switch wf.Status {
case jw.StatusRunning:
m.Logger.Info("New workflow [begin]", wf.Fields()...) //::::::::::::::::::::::::::::::::::::::::::::::::::::::::
default:
m.Logger.Info( //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
"Workflow finished",
"id", wf.ID,
"status", wf.Status,
"duration", (*wf.FinishedAt).Sub(wf.CreatedAt).String(),
)
}
}
func (m *Model) storageInsertWorkflow(wf *jw.Workflow, job *jw.Job) error {
// Cette insertion doit être faite dans une transaction.
if err := m.Storage.InsertWorkflow(wf, job); err != nil {
// AFINIR
return err
}
m.Logger.Info("New workflow [begin]", wf.Fields()...) //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
m.logWorkflow(wf)
m.logJob(job)
return nil
}
func (m *Model) storageUpdateWorkflow(wf *jw.Workflow, job, nextJob *jw.Job) error {
// Cette mise à jour doit être faite dans une transaction.
if err := m.Storage.UpdateWorkflow(wf, job, nextJob); err != nil {
// AFINIR
return err
@ -84,12 +99,7 @@ func (m *Model) storageUpdateWorkflow(wf *jw.Workflow, job, nextJob *jw.Job) err
m.logJob(job)
if nextJob == nil {
m.Logger.Info( //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
"Workflow finished",
"id", wf.ID,
"status", wf.Status,
"duration", (*wf.FinishedAt).Sub(wf.CreatedAt).String(),
)
m.logWorkflow(wf)
} else {
m.logJob(nextJob)
}

Loading…
Cancel
Save