Browse Source

Fixed Log.characters resolver not using dataloader

1.0
Gisle Aune 7 years ago
parent
commit
f15cc35e54
  1. 2
      cmd/rpdata-graphiql/main.go
  2. 8
      resolver/log.go

2
cmd/rpdata-graphiql/main.go

@ -28,7 +28,7 @@ func main() {
} }
log.Println("Updated characters on", n, "logs") log.Println("Updated characters on", n, "logs")
schema, err := graphql.ParseSchema(schema.String(), &resolver.RootResolver{}, graphql.MaxParallelism(32))
schema, err := graphql.ParseSchema(schema.String(), &resolver.RootResolver{}, graphql.MaxParallelism(48))
if err != nil { if err != nil {
log.Fatalln("Failed to parse schema:", err) log.Fatalln("Failed to parse schema:", err)
} }

8
resolver/log.go

@ -9,7 +9,6 @@ import (
"git.aiterp.net/rpdata/api/model/change" "git.aiterp.net/rpdata/api/model/change"
"git.aiterp.net/rpdata/api/internal/session" "git.aiterp.net/rpdata/api/internal/session"
"git.aiterp.net/rpdata/api/model/character"
"git.aiterp.net/rpdata/api/model/log" "git.aiterp.net/rpdata/api/model/log"
) )
@ -283,7 +282,12 @@ func (r *LogResolver) Open() bool {
// Characters resolves Log.characters // Characters resolves Log.characters
func (r *LogResolver) Characters(ctx context.Context) ([]*CharacterResolver, error) { func (r *LogResolver) Characters(ctx context.Context) ([]*CharacterResolver, error) {
chars, err := character.ListIDs(r.L.CharacterIDs...)
loader := loader.FromContext(ctx)
if loader == nil {
return nil, errors.New("no loader")
}
chars, err := loader.Characters("id", r.L.CharacterIDs...)
if err != nil { if err != nil {
return nil, err return nil, err
} }

Loading…
Cancel
Save