This commit is contained in:
@@ -44,6 +44,19 @@ func AdmitAndSchedule(ctx context.Context, store ports.GraphStore, request Graph
|
||||
for _, intent := range request.Intents {
|
||||
intentByDispatch[intent.DispatchID] = intent
|
||||
}
|
||||
for _, node := range admitted.Nodes {
|
||||
if node.DispatchID == "" {
|
||||
return work.WorkGraph{}, nil, ErrGraphDispatchBinding
|
||||
}
|
||||
if _, ok := intentByDispatch[node.DispatchID]; !ok {
|
||||
return work.WorkGraph{}, nil, ErrGraphDispatchBinding
|
||||
}
|
||||
}
|
||||
for _, intent := range request.Intents {
|
||||
if err := store.SaveDispatchIntent(ctx, intent); err != nil {
|
||||
return work.WorkGraph{}, nil, err
|
||||
}
|
||||
}
|
||||
next := admitted
|
||||
next.Revision++
|
||||
next.State = work.GraphRunning
|
||||
@@ -58,13 +71,7 @@ func AdmitAndSchedule(ctx context.Context, store ports.GraphStore, request Graph
|
||||
if next.Nodes[i].DispatchID == "" {
|
||||
return work.WorkGraph{}, nil, ErrGraphDispatchBinding
|
||||
}
|
||||
intent, ok := intentByDispatch[next.Nodes[i].DispatchID]
|
||||
if !ok {
|
||||
return work.WorkGraph{}, nil, ErrGraphDispatchBinding
|
||||
}
|
||||
if err := store.SaveDispatchIntent(ctx, intent); err != nil {
|
||||
return work.WorkGraph{}, nil, err
|
||||
}
|
||||
intent := intentByDispatch[next.Nodes[i].DispatchID]
|
||||
if err := store.EnqueueDispatch(ctx, work.AgentDispatchQueueItem{DispatchID: intent.DispatchID, State: work.AgentDispatchQueued, AvailableAtUnixMillis: request.Now, UpdatedAtUnixMillis: request.Now}); err != nil {
|
||||
return work.WorkGraph{}, nil, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user