forked from longtao.wu/droboticflow
28 lines
816 B
Go
28 lines
816 B
Go
package api
|
|
|
|
import (
|
|
"context"
|
|
"droboticflow/internal/domain"
|
|
"droboticflow/internal/store"
|
|
)
|
|
|
|
// A revision waiting for source validation is not itself validating media.
|
|
// Read the durable validator lease so all API replicas show the same state.
|
|
func (s *server) annotationProcessingStage(ctx context.Context, org string, j *domain.AnnotationProcessingJob) string {
|
|
if j.Stage != "validating" || (j.Status != "queued" && j.Status != "running") {
|
|
return j.Stage
|
|
}
|
|
db, ok := s.store.(store.AnnotationProcessingStore)
|
|
if !ok || j.SourceFingerprint == "" {
|
|
return j.Stage
|
|
}
|
|
index, err := db.GetAnnotationIndexJob(ctx, store.AnnotationSourceJobID(org, j.SourceFingerprint))
|
|
if err != nil {
|
|
return j.Stage
|
|
}
|
|
if index == nil || index.Status == "queued" {
|
|
return "waiting_source"
|
|
}
|
|
return j.Stage
|
|
}
|