Skip to content

Commit

Permalink
fix pipeline bug (#1027)
Browse files Browse the repository at this point in the history
  • Loading branch information
yaron2 committed Feb 11, 2020
1 parent 5a67f83 commit 6e19df1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
1 change: 1 addition & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -996,6 +996,7 @@ gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I=
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.7 h1:VUgggvou5XRW9mHwD/yXxIYSMtY0zoKQf/v226p2nyo=
gopkg.in/yaml.v2 v2.2.7/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
Expand Down
27 changes: 15 additions & 12 deletions pkg/runtime/runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,19 +227,22 @@ func (a *DaprRuntime) initRuntime(opts *runtimeOpts) error {

func (a *DaprRuntime) buildHTTPPipeline() (http_middleware.Pipeline, error) {
var handlers []http_middleware.Middleware
for i := 0; i < len(a.globalConfig.Spec.HTTPPipelineSpec.Handlers); i++ {
component := a.getComponent(a.globalConfig.Spec.HTTPPipelineSpec.Handlers[i].Type, a.globalConfig.Spec.HTTPPipelineSpec.Handlers[i].Name)
if component == nil {
return http_middleware.Pipeline{}, fmt.Errorf("couldn't find middleware %s of type %s",
a.globalConfig.Spec.HTTPPipelineSpec.Handlers[i].Name,
a.globalConfig.Spec.HTTPPipelineSpec.Handlers[i].Type)
}
handler, err := a.httpMiddlewareRegistry.Create(a.globalConfig.Spec.HTTPPipelineSpec.Handlers[i].Type,
middleware.Metadata{Properties: a.convertMetadataItemsToProperties(component.Spec.Metadata)})
if err != nil {
return http_middleware.Pipeline{}, err

if a.globalConfig != nil {
for i := 0; i < len(a.globalConfig.Spec.HTTPPipelineSpec.Handlers); i++ {
component := a.getComponent(a.globalConfig.Spec.HTTPPipelineSpec.Handlers[i].Type, a.globalConfig.Spec.HTTPPipelineSpec.Handlers[i].Name)
if component == nil {
return http_middleware.Pipeline{}, fmt.Errorf("couldn't find middleware %s of type %s",
a.globalConfig.Spec.HTTPPipelineSpec.Handlers[i].Name,
a.globalConfig.Spec.HTTPPipelineSpec.Handlers[i].Type)
}
handler, err := a.httpMiddlewareRegistry.Create(a.globalConfig.Spec.HTTPPipelineSpec.Handlers[i].Type,
middleware.Metadata{Properties: a.convertMetadataItemsToProperties(component.Spec.Metadata)})
if err != nil {
return http_middleware.Pipeline{}, err
}
handlers = append(handlers, handler)
}
handlers = append(handlers, handler)
}
return http_middleware.Pipeline{Handlers: handlers}, nil
}
Expand Down

0 comments on commit 6e19df1

Please sign in to comment.