From c98cbb8edc8f2cdffcc8e56f9806356d0fc69ddf Mon Sep 17 00:00:00 2001 From: Aditya Mathur Date: Mon, 1 Jul 2024 16:15:26 +0530 Subject: [PATCH] fix(sandbox): corrected tests --- apps/sandbox/src/index.ts | 41 +++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/apps/sandbox/src/index.ts b/apps/sandbox/src/index.ts index 9b028c9..569f749 100644 --- a/apps/sandbox/src/index.ts +++ b/apps/sandbox/src/index.ts @@ -1,5 +1,5 @@ import { promisify } from "node:util"; -import { serve } from "@hono/node-server"; +import { createAdaptorServer, serve } from "@hono/node-server"; import { Hono } from "hono"; import { underPressure } from "hono-under-pressure"; @@ -8,29 +8,28 @@ const wait = promisify(setTimeout); const app = new Hono(); app.get("/", async (c) => { - await wait(1000); // Synthetic load + await wait(900); // Synthetic load return c.text("Hello Hono!"); }); const port = 3000; console.log(`Server is running on port ${port}`); -// serve({ -// fetch: app.fetch, -// port, -// }); - -underPressure( - (handlers) => { - const newApp = new Hono().use(...handlers).route("/", app); - - return serve({ - fetch: newApp.fetch, - port, - }); - }, - { - maxEventLoopDelay: 200, - maxEventLoopUtilization: 0.8, - }, -); +serve({ + fetch: app.fetch, + port, +}); + +// const server = underPressure( +// (handlers) => { +// const newApp = new Hono().use(...handlers).route("/", app); + +// return createAdaptorServer(newApp); +// }, +// { +// maxEventLoopDelay: 3, +// maxEventLoopUtilization: 0.3, +// } +// ); + +// server.listen(3000, "0.0.0.0");