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

Retain server context prototype for batched requests #3270

Merged
merged 1 commit into from
May 15, 2024

Conversation

andrew0
Copy link
Contributor

@andrew0 andrew0 commented May 15, 2024

I am using graphql-yoga with Koa, and I want to pass a server context object with a prototype to handleNodeRequest. This works for regular requests, but for batched requests, the prototype is lost, and only the enumerable properties get copied to the request-specific context objects. This change makes it so that batched requests use Object.create for the extended context instead of an empty object.

Copy link

changeset-bot bot commented May 15, 2024

🦋 Changeset detected

Latest commit: 05b11f8

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

This PR includes changesets to release 9 packages
Name Type
graphql-yoga Patch
apollo-federation-gateway-with-yoga Patch
apollo-subgraph-with-yoga Patch
graphql-lambda Patch
cloudflare-advanced Patch
cloudflare Patch
functions Patch
nextjs-app Patch
hello-world-benchmark 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

@n1ru4l n1ru4l requested review from ardatan and n1ru4l May 15, 2024 08:32
@n1ru4l n1ru4l merged commit f9aa1cd into dotansimha:main May 15, 2024
25 checks passed
Copy link
Contributor

✅ Benchmark Results

     ✓ no_errors{mode:graphql}
     ✓ expected_result{mode:graphql}
     ✓ no_errors{mode:graphql-jit}
     ✓ expected_result{mode:graphql-jit}
     ✓ no_errors{mode:graphql-response-cache}
     ✓ expected_result{mode:graphql-response-cache}
     ✓ no_errors{mode:graphql-no-parse-validate-cache}
     ✓ expected_result{mode:graphql-no-parse-validate-cache}

     checks.......................................: 100.00% ✓ 397252      ✗ 0     
     data_received................................: 1.6 GB  13 MB/s
     data_sent....................................: 80 MB   668 kB/s
     http_req_blocked.............................: avg=1.47µs   min=942ns    med=1.32µs   max=257.68µs p(90)=1.96µs   p(95)=2.16µs  
     http_req_connecting..........................: avg=2ns      min=0s       med=0s       max=139.82µs p(90)=0s       p(95)=0s      
     http_req_duration............................: avg=390.95µs min=221.17µs med=345.32µs max=25ms     p(90)=545.6µs  p(95)=564.83µs
       { expected_response:true }.................: avg=390.95µs min=221.17µs med=345.32µs max=25ms     p(90)=545.6µs  p(95)=564.83µs
     ✓ { mode:graphql-jit }.......................: avg=294.24µs min=221.17µs med=271.74µs max=18.28ms  p(90)=303.8µs  p(95)=319.03µs
     ✓ { mode:graphql-no-parse-validate-cache }...: avg=573.98µs min=478.84µs med=544.42µs max=9.84ms   p(90)=584.88µs p(95)=618.65µs
     ✓ { mode:graphql-response-cache }............: avg=367.39µs min=288.19µs med=347.58µs max=9.18ms   p(90)=378.79µs p(95)=389.9µs 
     ✓ { mode:graphql }...........................: avg=391.17µs min=302.44µs med=353.69µs max=25ms     p(90)=406.78µs p(95)=468.39µs
     http_req_failed..............................: 0.00%   ✓ 0           ✗ 198626
     http_req_receiving...........................: avg=33.45µs  min=16.47µs  med=33.31µs  max=872.56µs p(90)=39.23µs  p(95)=41.62µs 
     http_req_sending.............................: avg=8.35µs   min=5.83µs   med=7.4µs    max=3.02ms   p(90)=10.94µs  p(95)=11.82µs 
     http_req_tls_handshaking.....................: avg=0s       min=0s       med=0s       max=0s       p(90)=0s       p(95)=0s      
     http_req_waiting.............................: avg=349.14µs min=186.18µs med=304.27µs max=24.79ms  p(90)=503.62µs p(95)=520.52µs
     http_reqs....................................: 198626  1655.188895/s
     iteration_duration...........................: avg=599.3µs  min=390.21µs med=550.02µs max=25.84ms  p(90)=756.43µs p(95)=779.75µs
     iterations...................................: 198626  1655.188895/s
     vus..........................................: 1       min=1         max=1   
     vus_max......................................: 2       min=2         max=2   

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.

3 participants