Skip to content

Commit

Permalink
don't cast Value when pipe is errored
Browse files Browse the repository at this point in the history
Signed-off-by: Maxime Lagresle <maxime@angel.co>
  • Loading branch information
maxlaverse committed Oct 2, 2021
1 parent 42aefeb commit e76cfcf
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion solver/edge.go
Original file line number Diff line number Diff line change
@@ -458,7 +458,14 @@ func (e *edge) processUpdate(upt pipe.Receiver) (depChanged bool) {
dep.err = err
}

state := upt.Status().Value.(*edgeState)
if upt.Status().Value == nil {
return
}
state, isEdgeState := upt.Status().Value.(*edgeState)
if !isEdgeState {
bklog.G(context.TODO()).Warnf("invalid edgeState value for update: %T", state)
return
}

if len(dep.keys) < len(state.keys) {
newKeys := state.keys[len(dep.keys):]
2 changes: 1 addition & 1 deletion solver/scheduler.go
Original file line number Diff line number Diff line change
@@ -352,7 +352,7 @@ func (pf *pipeFactory) NewInputRequest(ee Edge, req *edgeRequest) pipe.Receiver
target := pf.s.ef.getEdge(ee)
if target == nil {
return pf.NewFuncRequest(func(_ context.Context) (interface{}, error) {
return req, errors.Errorf("failed to get edge: inconsistent graph state")
return nil, errors.Errorf("failed to get edge: inconsistent graph state")
})
}
p := pf.s.newPipe(target, pf.e, pipe.Request{Payload: req})

0 comments on commit e76cfcf

Please sign in to comment.