Merge pull request #2385 from venturehacks/panic_failed_to_get_edge

don't cast Value when pipe is errored
master
Tõnis Tiigi 2021-10-02 14:06:59 -07:00 committed by GitHub
commit d429b0b326
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 2 deletions

View File

@ -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):]

View File

@ -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})