Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix async schema #1382

Closed
wants to merge 8 commits into from
Closed

Fix async schema #1382

wants to merge 8 commits into from

Conversation

ardatan
Copy link
Collaborator

@ardatan ardatan commented Apr 30, 2022

No description provided.

@changeset-bot
Copy link

changeset-bot bot commented Apr 30, 2022

🦋 Changeset detected

Latest commit: 0e0fb85

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@envelop/core Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link

vercel bot commented Apr 30, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
envelop ✅ Ready (Inspect) Visit Preview May 2, 2022 at 0:01AM (UTC)

@theguild-bot
Copy link
Collaborator

theguild-bot commented Apr 30, 2022

The latest changes of this PR are available as alpha in npm (based on the declared changesets):

@envelop/core@2.3.2-alpha-b81730b.0
@envelop/apollo-federation@2.3.2-alpha-b81730b.0
@envelop/apollo-server-errors@3.3.2-alpha-b81730b.0
@envelop/apollo-tracing@3.3.2-alpha-b81730b.0
@envelop/auth0@3.3.2-alpha-b81730b.0
@envelop/dataloader@3.3.2-alpha-b81730b.0
@envelop/depth-limit@1.5.2-alpha-b81730b.0
@envelop/disable-introspection@3.3.2-alpha-b81730b.0
@envelop/execute-subscription-event@2.3.2-alpha-b81730b.0
@envelop/extended-validation@1.6.2-alpha-b81730b.0
@envelop/filter-operation-type@3.3.2-alpha-b81730b.0
@envelop/fragment-arguments@3.3.2-alpha-b81730b.0
@envelop/generic-auth@4.2.2-alpha-b81730b.0
@envelop/graphql-jit@4.2.2-alpha-b81730b.0
@envelop/graphql-middleware@3.3.2-alpha-b81730b.0
@envelop/graphql-modules@3.3.2-alpha-b81730b.0
@envelop/live-query@3.3.2-alpha-b81730b.0
@envelop/newrelic@4.0.1-alpha-b81730b.0
@envelop/opentelemetry@3.3.2-alpha-b81730b.0
@envelop/operation-field-permissions@3.3.2-alpha-b81730b.0
@envelop/parser-cache@4.3.2-alpha-b81730b.0
@envelop/persisted-operations@4.3.2-alpha-b81730b.0
@envelop/preload-assets@3.3.2-alpha-b81730b.0
@envelop/prometheus@6.3.2-alpha-b81730b.0
@envelop/rate-limiter@3.3.2-alpha-b81730b.0
@envelop/resource-limitations@2.3.2-alpha-b81730b.0
@envelop/response-cache@2.3.2-alpha-b81730b.0
@envelop/response-cache-redis@0.4.2-alpha-b81730b.0
@envelop/sentry@3.4.1-alpha-b81730b.0
@envelop/statsd@2.3.2-alpha-b81730b.0
@envelop/validation-cache@4.3.2-alpha-b81730b.0
@envelop/testing@4.3.2-alpha-b81730b.0

@theguild-bot
Copy link
Collaborator

theguild-bot commented Apr 30, 2022

✅ Benchmark Results

     ✓ no_errors
     ✓ expected_result

     checks.............................................: 100.00% ✓ 621702      ✗ 0     
     data_received......................................: 2.4 GB  16 MB/s
     data_sent..........................................: 135 MB  902 kB/s
     envelop_init.......................................: avg=504ns    min=99ns     med=299ns   max=1.25ms   p(90)=800ns   p(95)=1.89µs  
     ✓ { mode:envelop-cache-jit }.......................: avg=348ns    min=99ns     med=300ns   max=132.6µs  p(90)=599ns   p(95)=700ns   
     ✓ { mode:envelop-just-cache }......................: avg=265ns    min=99ns     med=200ns   max=166.3µs  p(90)=499ns   p(95)=599ns   
     ✓ { mode:graphql-js }..............................: avg=550ns    min=99ns     med=299ns   max=1.25ms   p(90)=2.09µs  p(95)=2.29µs  
     ✓ { mode:prom-tracing }............................: avg=2.49µs   min=1.19µs   med=1.79µs  max=407.9µs  p(90)=3.2µs   p(95)=7.79µs  
     envelop_total......................................: avg=194.54µs min=0s       med=20.1µs  max=19.23ms  p(90)=452.9µs p(95)=1.37ms  
     ✓ { mode:envelop-cache-jit }.......................: avg=20.13µs  min=14.49µs  med=18.8µs  max=7.71ms   p(90)=24.8µs  p(95)=27.8µs  
     ✓ { mode:envelop-just-cache }......................: avg=174.14µs min=140µs    med=167.8µs max=14.84ms  p(90)=182.8µs p(95)=192.7µs 
     ✓ { mode:graphql-js }..............................: avg=496.25µs min=406.2µs  med=448.5µs max=15.18ms  p(90)=489.4µs p(95)=535.91µs
     ✓ { mode:prom-tracing }............................: avg=1.64ms   min=1.31ms   med=1.53ms  max=19.23ms  p(90)=1.65ms  p(95)=2.9ms   
     event_loop_lag.....................................: avg=0s       min=0s       med=0s      max=0s       p(90)=0s      p(95)=0s      
     ✓ { mode:envelop-cache-and-no-internal-tracing }...: avg=0s       min=0s       med=0s      max=0s       p(90)=0s      p(95)=0s      
     ✓ { mode:envelop-cache-jit }.......................: avg=0s       min=0s       med=0s      max=0s       p(90)=0s      p(95)=0s      
     ✓ { mode:envelop-just-cache }......................: avg=0s       min=0s       med=0s      max=0s       p(90)=0s      p(95)=0s      
     ✓ { mode:graphql-js }..............................: avg=0s       min=0s       med=0s      max=0s       p(90)=0s      p(95)=0s      
     ✓ { mode:prom-tracing }............................: avg=0s       min=0s       med=0s      max=0s       p(90)=0s      p(95)=0s      
     graphql_context....................................: avg=3.43µs   min=1.59µs   med=2.69µs  max=2.1ms    p(90)=5.4µs   p(95)=6.9µs   
     ✓ { mode:envelop-cache-jit }.......................: avg=2.46µs   min=1.59µs   med=2.19µs  max=2.1ms    p(90)=3.29µs  p(95)=3.9µs   
     ✓ { mode:envelop-just-cache }......................: avg=2.88µs   min=1.99µs   med=2.7µs   max=581.9µs  p(90)=3.39µs  p(95)=3.8µs   
     ✓ { mode:graphql-js }..............................: avg=5.43µs   min=3.49µs   med=4.5µs   max=2.1ms    p(90)=8.19µs  p(95)=9.2µs   
     ✓ { mode:prom-tracing }............................: avg=7.11µs   min=5.49µs   med=6.8µs   max=279.2µs  p(90)=7.89µs  p(95)=9.09µs  
     graphql_execute....................................: avg=201.29µs min=8.3µs    med=149.2µs max=19.01ms  p(90)=183µs   p(95)=1.42ms  
     ✓ { mode:envelop-cache-jit }.......................: avg=11.01µs  min=8.3µs    med=10.4µs  max=6.36ms   p(90)=12.6µs  p(95)=13.89µs 
     ✓ { mode:envelop-just-cache }......................: avg=164.71µs min=132.4µs  med=158.5µs max=14.83ms  p(90)=172.5µs p(95)=181.89µs
     ✓ { mode:graphql-js }..............................: avg=188.44µs min=155.1µs  med=167.3µs max=10.43ms  p(90)=181.1µs p(95)=191.8µs 
     ✓ { mode:prom-tracing }............................: avg=1.58ms   min=1.25ms   med=1.47ms  max=19.01ms  p(90)=1.57ms  p(95)=2.84ms  
     graphql_parse......................................: avg=9.42µs   min=2.79µs   med=4.6µs   max=8.88ms   p(90)=15.4µs  p(95)=47.3µs  
     ✓ { mode:envelop-cache-jit }.......................: avg=4.69µs   min=2.79µs   med=4.29µs  max=2.18ms   p(90)=6.3µs   p(95)=7.29µs  
     ✓ { mode:envelop-just-cache }......................: avg=4.86µs   min=3.2µs    med=4.49µs  max=1.2ms    p(90)=5.79µs  p(95)=6.69µs  
     ✓ { mode:graphql-js }..............................: avg=13.16µs  min=8.39µs   med=10.79µs max=8.88ms   p(90)=16.9µs  p(95)=19.1µs  
     ✓ { mode:prom-tracing }............................: avg=51.09µs  min=40.4µs   med=49.7µs  max=989.41µs p(90)=57.5µs  p(95)=62µs    
     graphql_validate...................................: avg=50.86µs  min=799ns    med=1.5µs   max=14.85ms  p(90)=263.2µs p(95)=269.7µs 
     ✓ { mode:envelop-cache-jit }.......................: avg=1.61µs   min=899ns    med=1.5µs   max=1.08ms   p(90)=2µs     p(95)=2.19µs  
     ✓ { mode:envelop-just-cache }......................: avg=1.41µs   min=799ns    med=1.1µs   max=7.14ms   p(90)=1.59µs  p(95)=1.79µs  
     ✓ { mode:graphql-js }..............................: avg=288.66µs min=230.1µs  med=264.6µs max=14.85ms  p(90)=285.6µs p(95)=307.59µs
     ✓ { mode:prom-tracing }............................: avg=5.7µs    min=3.99µs   med=5.1µs   max=1.59ms   p(90)=6.8µs   p(95)=8.49µs  
     http_req_blocked...................................: avg=2.82µs   min=700ns    med=1.3µs   max=11.24ms  p(90)=2.1µs   p(95)=2.5µs   
     http_req_connecting................................: avg=348ns    min=0s       med=0s      max=5.64ms   p(90)=0s      p(95)=0s      
     http_req_duration..................................: avg=4.43ms   min=188.2µs  med=2.83ms  max=85.61ms  p(90)=9.9ms   p(95)=15.35ms 
       { expected_response:true }.......................: avg=4.43ms   min=188.2µs  med=2.83ms  max=85.61ms  p(90)=9.9ms   p(95)=15.35ms 
     ✓ { mode:envelop-cache-and-no-internal-tracing }...: avg=3.3ms    min=334.5µs  med=2.58ms  max=54.29ms  p(90)=5.33ms  p(95)=6.47ms  
     ✓ { mode:envelop-cache-jit }.......................: avg=2.61ms   min=188.2µs  med=1.9ms   max=32.66ms  p(90)=5.16ms  p(95)=9.42ms  
     ✓ { mode:envelop-just-cache }......................: avg=3.61ms   min=331µs    med=2.86ms  max=47.87ms  p(90)=6.01ms  p(95)=7.89ms  
     ✓ { mode:graphql-js }..............................: avg=7.29ms   min=767.81µs med=5.65ms  max=72.28ms  p(90)=12.2ms  p(95)=13.31ms 
     ✓ { mode:prom-tracing }............................: avg=18.5ms   min=2.41ms   med=16.86ms max=85.61ms  p(90)=30.61ms p(95)=34.1ms  
     http_req_failed....................................: 0.00%   ✓ 0           ✗ 310851
     http_req_receiving.................................: avg=51.78µs  min=11.7µs   med=21µs    max=30.21ms  p(90)=32.5µs  p(95)=41.7µs  
     http_req_sending...................................: avg=36.95µs  min=4.1µs    med=7.4µs   max=32.84ms  p(90)=14µs    p(95)=23.2µs  
     http_req_tls_handshaking...........................: avg=0s       min=0s       med=0s      max=0s       p(90)=0s      p(95)=0s      
     http_req_waiting...................................: avg=4.34ms   min=152.7µs  med=2.79ms  max=85.53ms  p(90)=9.49ms  p(95)=15.26ms 
     http_reqs..........................................: 310851  2072.231272/s
     iteration_duration.................................: avg=4.81ms   min=414.4µs  med=3.1ms   max=86.01ms  p(90)=10.72ms p(95)=15.76ms 
     iterations.........................................: 310851  2072.231272/s
     vus................................................: 10      min=10        max=11  
     vus_max............................................: 20      min=20        max=20  

setSchema(schema$);
}
},
onExecute() {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the idea here is to defer execution until the schema is set - But that will still let validation fail 🤔

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's why I left this PR draft :D because only if you don't do validate you can use promises for schema.

@ardatan
Copy link
Collaborator Author

ardatan commented Sep 6, 2022

@saihaj closing this one in favor of your PRs

@ardatan ardatan closed this Sep 6, 2022
@ardatan ardatan deleted the fix-async-schema branch September 6, 2022 14:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants