Skip to content

Commit

Permalink
Merge pull request #24 from GannettDigital/performance
Browse files Browse the repository at this point in the history
Set all auto-generated resolve functions to resolve serially
  • Loading branch information
tkuhlman authored Mar 6, 2020
2 parents 0313f10 + b191506 commit 603a4cc
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module github.com/GannettDigital/graphql-gen

require github.com/GannettDigital/graphql v0.0.0-20180502221234-69afe7345de2
require github.com/GannettDigital/graphql v0.8.2

go 1.13
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
github.com/GannettDigital/graphql v0.0.0-20180502221234-69afe7345de2 h1:UX3UiSWtirltOWcEf6GiXpY3yhosQHRzUjuXqeumeZc=
github.com/GannettDigital/graphql v0.0.0-20180502221234-69afe7345de2/go.mod h1:lbqlJ35xvVRSsEjEXGH96xlGDuy63f0MCYu86JTd96c=
github.com/GannettDigital/graphql v0.8.2 h1:9ozB5DieYfwN7AOnUSybgONQS8s2L8LyN/xT5Tvm7y4=
github.com/GannettDigital/graphql v0.8.2/go.mod h1:/pBTUuGF3BiEuSQor7AUwe2u8BrFQx+m/EIvNpu2R94=
7 changes: 4 additions & 3 deletions gql/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,9 +273,10 @@ func (ob *ObjectBuilder) buildFields(sType reflect.Type, parent string, baseFiel
name := fieldName(field)
description := field.Tag.Get("description")
f := &graphql.Field{
Name: name,
Type: gtype,
Resolve: ResolveByField(name, parent),
Name: name,
Type: gtype,
Resolve: ResolveByField(name, parent),
ResolveSerial: true, // autogenerated fields don't require any network activity so always resolve serially
}

if strings.HasPrefix(description, deprecationPrefix) {
Expand Down

0 comments on commit 603a4cc

Please sign in to comment.