-
Notifications
You must be signed in to change notification settings - Fork 222
Description
While working on performance improvements for our large GraphQL application I noticed something odd.
I disabled config_validation, use_classloader_listener and auto_compile and noticed that for some queries \GraphQL\Type\Schema::getTypeMap was called. The description of that method warns that it's slow: "This operation requires full schema scan. Do not use in production environment.".
I notice this was because of a misconfiguration in my application. It couldn't find an EnumType and would then fallback to calling getType that would eventually call getTypeMap. That was able to find the type and register it properly.
See
GraphQLBundle/src/Definition/Type/ExtensibleSchema.php
Lines 66 to 74 in 886cd9d
| try { | |
| $type = $typeLoader($name); | |
| } catch (UnresolvableException $e) { | |
| // second chance for types with un-registered name in TypeResolver | |
| // we disabled the custom typeLoader to force default loader usage | |
| $schemaConfig->typeLoader = null; | |
| $type = $this->getType($name); | |
| $schemaConfig->typeLoader = $loaderWrapper; | |
| } |
Why is this fallback in place? Wouldn't it be better to fail immediately so that developers know their configuration is not right. Having these things automagically resolved is nice, but does not benefit performance and leaves bad config as is.