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(server): use ServerResponse's close event to catch request cancellation #1220

Merged
merged 3 commits into from Mar 22, 2024

Conversation

ardatan
Copy link
Owner

@ardatan ardatan commented Mar 21, 2024

No description provided.

Copy link

codesandbox bot commented Mar 21, 2024

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

Copy link
Contributor

github-actions bot commented Mar 21, 2024

@benchmarks/node-fetch results (consumeBody)

   ✓ active_handles.................: avg=141.065325 min=104     med=142     max=200      p(90)=155     p(95)=159    
     data_received..................: 22 MB  723 kB/s
     data_sent......................: 14 MB  464 kB/s
     http_req_blocked...............: avg=6.7µs      min=691ns   med=1.45µs  max=18.25ms  p(90)=2.11µs  p(95)=2.38µs 
     http_req_connecting............: avg=3.94µs     min=0s      med=0s      max=14.58ms  p(90)=0s      p(95)=0s     
     http_req_duration..............: avg=21.07ms    min=8.29ms  med=20.82ms max=285.77ms p(90)=26.72ms p(95)=28.81ms
       { expected_response:true }...: avg=21.07ms    min=8.29ms  med=20.82ms max=285.77ms p(90)=26.72ms p(95)=28.81ms
     http_req_failed................: 0.00%  ✓ 0           ✗ 141862
     http_req_receiving.............: avg=36.83µs    min=10.57µs med=27.31µs max=41.1ms   p(90)=42.99µs p(95)=51.27µs
     http_req_sending...............: avg=11.9µs     min=3.22µs  med=6.99µs  max=12.87ms  p(90)=10.03µs p(95)=14.26µs
     http_req_tls_handshaking.......: avg=0s         min=0s      med=0s      max=0s       p(90)=0s      p(95)=0s     
     http_req_waiting...............: avg=21.02ms    min=8.22ms  med=20.77ms max=285.66ms p(90)=26.68ms p(95)=28.76ms
     http_reqs......................: 141862 4728.406424/s
     iteration_duration.............: avg=42.25ms    min=25.23ms med=41.04ms max=322.28ms p(90)=46.82ms p(95)=52.66ms
     iterations.....................: 70907  2363.403267/s
     vus............................: 100    min=100       max=100 
     vus_max........................: 100    min=100       max=100 

Copy link
Contributor

github-actions bot commented Mar 21, 2024

🚀 Snapshot Release (alpha)

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

Package Version Info
@whatwg-node/node-fetch 0.5.10-alpha-20240322103629-07f53b56429d0c2dcdb6dcd240226e0f599203e0 npm ↗︎ unpkg ↗︎
@whatwg-node/server 0.9.31-alpha-20240322103629-07f53b56429d0c2dcdb6dcd240226e0f599203e0 npm ↗︎ unpkg ↗︎

Copy link
Contributor

github-actions bot commented Mar 21, 2024

@benchmarks/node-fetch results (noConsumeBody)

   ✓ active_handles.................: avg=140.208334 min=20      med=141     max=200      p(90)=156     p(95)=162    
     data_received..................: 25 MB  821 kB/s
     data_sent......................: 16 MB  532 kB/s
     http_req_blocked...............: avg=2.25µs     min=672ns   med=1.36µs  max=9.73ms   p(90)=1.96µs  p(95)=2.18µs 
     http_req_connecting............: avg=479ns      min=0s      med=0s      max=2.75ms   p(90)=0s      p(95)=0s     
     http_req_duration..............: avg=18.57ms    min=1.87ms  med=18.28ms max=906.81ms p(90)=23.83ms p(95)=25.22ms
       { expected_response:true }...: avg=18.57ms    min=1.87ms  med=18.28ms max=906.81ms p(90)=23.83ms p(95)=25.22ms
     http_req_failed................: 0.00%  ✓ 0           ✗ 161024
     http_req_receiving.............: avg=35.38µs    min=8.67µs  med=25.19µs max=17.72ms  p(90)=39.83µs p(95)=48.46µs
     http_req_sending...............: avg=11.04µs    min=2.76µs  med=6.06µs  max=19.47ms  p(90)=9.05µs  p(95)=14.59µs
     http_req_tls_handshaking.......: avg=0s         min=0s      med=0s      max=0s       p(90)=0s      p(95)=0s     
     http_req_waiting...............: avg=18.52ms    min=1.83ms  med=18.24ms max=906.73ms p(90)=23.79ms p(95)=25.15ms
     http_reqs......................: 161024 5367.022079/s
     iteration_duration.............: avg=37.23ms    min=10.83ms med=36.34ms max=922.32ms p(90)=40.27ms p(95)=44.86ms
     iterations.....................: 80491  2682.811097/s
     vus............................: 100    min=100       max=100 
     vus_max........................: 100    min=100       max=100 

Copy link
Contributor

github-actions bot commented Mar 21, 2024

@benchmarks/server results

     ✓ no-errors
     ✓ expected-result

   ✓ checks.........................: 100.00% ✓ 293336      ✗ 0     
     data_received..................: 29 MB   963 kB/s
     data_sent......................: 12 MB   391 kB/s
     http_req_blocked...............: avg=1.34µs   min=861ns   med=1.15µs   max=209.93µs p(90)=1.83µs   p(95)=1.97µs  
     http_req_connecting............: avg=0ns      min=0s      med=0s       max=128.11µs p(90)=0s       p(95)=0s      
     http_req_duration..............: avg=143.49µs min=97.78µs med=139.06µs max=6.8ms    p(90)=160.44µs p(95)=166.9µs 
       { expected_response:true }...: avg=143.49µs min=97.78µs med=139.06µs max=6.8ms    p(90)=160.44µs p(95)=166.9µs 
     http_req_failed................: 0.00%   ✓ 0           ✗ 146668
     http_req_receiving.............: avg=24.9µs   min=11.52µs med=23.8µs   max=5.06ms   p(90)=30.41µs  p(95)=32.4µs  
     http_req_sending...............: avg=5.89µs   min=3.67µs  med=5.16µs   max=4.95ms   p(90)=7.54µs   p(95)=7.97µs  
     http_req_tls_handshaking.......: avg=0s       min=0s      med=0s       max=0s       p(90)=0s       p(95)=0s      
     http_req_waiting...............: avg=112.68µs min=71.02µs med=108.04µs max=6.49ms   p(90)=126.41µs p(95)=131.55µs
     http_reqs......................: 146668  4888.908823/s
     iteration_duration.............: avg=198.74µs min=142.6µs med=193.3µs  max=7.86ms   p(90)=217.78µs p(95)=226.15µs
     iterations.....................: 146668  4888.908823/s
     vus............................: 1       min=1         max=1   
     vus_max........................: 1       min=1         max=1   

@ardatan ardatan marked this pull request as ready for review March 22, 2024 10:39
@ardatan ardatan merged commit ac6b719 into master Mar 22, 2024
21 checks passed
@ardatan ardatan deleted the correct-event-for-req-cancellation branch March 22, 2024 10:40
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

2 participants