Skip to content

Commit

Permalink
fix(sandbox): corrected tests
Browse files Browse the repository at this point in the history
  • Loading branch information
MathurAditya724 committed Jul 1, 2024
1 parent 6e6242e commit c98cbb8
Showing 1 changed file with 20 additions and 21 deletions.
41 changes: 20 additions & 21 deletions apps/sandbox/src/index.ts
Original file line number Diff line number Diff line change
@@ -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";

Expand All @@ -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");

0 comments on commit c98cbb8

Please sign in to comment.