We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
The new Deno.serve method only appears to be allowing one request at a time.
I have two examples below:
Deno.serve
std HTTP serve
Command: RUST_BACKTRACE=full deno run -A --unstable serve-test.ts
RUST_BACKTRACE=full deno run -A --unstable serve-test.ts
Source:
let active = 0; const sleep = (time: number) => new Promise(r => setTimeout(r, time)); const start = (pathname: string) => { active++; console.log(`⏰ Request received ${pathname} | Total Active: ${active}`) }; const end = (pathname: string) => { active--; console.log(`✅ Request completed ${pathname} | Total Active: ${active}`); } const handler: Deno.ServeHandler = async (event) => { const pathname = new URL(event.url).pathname; start(pathname); await sleep(2000); try { return new Response('done'); } finally { end(pathname); } }; Deno.serve( { handler, port: 9999, onListen({ hostname, port }) { console.log(`Server Started... http://${hostname}:${port}/`); } } )
Command: RUST_BACKTRACE=full deno run -A serve-test.ts
RUST_BACKTRACE=full deno run -A serve-test.ts
import { serve } from "https://deno.land/std@0.154.0/http/server.ts"; let active = 0; const sleep = (time: number) => new Promise(r => setTimeout(r, time)); const start = (pathname: string) => { active++; console.log(`⏰ Request received ${pathname} | Total Active: ${active}`) }; const end = (pathname: string) => { active--; console.log(`✅ Request completed ${pathname} | Total Active: ${active}`); } const handler: Deno.ServeHandler = async (event) => { const pathname = new URL(event.url).pathname; start(pathname); await sleep(2000); try { return new Response('done'); } finally { end(pathname); } }; serve( handler, { port: 9999, onListen({ hostname, port }) { console.log(`Server Started... http://${hostname}:${port}/`); } } )
The text was updated successfully, but these errors were encountered:
Thanks for the detailed reproduction. I can confirm that #15852 fixes the issue:
Sorry, something went wrong.
@littledivy Thanks for the fix!
littledivy
Successfully merging a pull request may close this issue.
Description
The new Deno.serve method only appears to be allowing one request at a time.
I have two examples below:
Deno.serve
(Runs all requests synchronously)std HTTP serve
(Runs all requests in parallel)Example (Using Deno.serve)
Command:
RUST_BACKTRACE=full deno run -A --unstable serve-test.ts
Source:
Example (Using std/http/server)
Command:
RUST_BACKTRACE=full deno run -A serve-test.ts
Source:
The text was updated successfully, but these errors were encountered: