From da34367d35ab50fb14552e67b7a2b6d38a7834d6 Mon Sep 17 00:00:00 2001 From: Devin Ivy Date: Tue, 5 May 2026 22:30:43 -0400 Subject: [PATCH] fix(examples): use threadId instead of pid in server-threads example Co-Authored-By: Claude Opus 4.6 (1M context) --- examples/server-threads/server.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/server-threads/server.ts b/examples/server-threads/server.ts index 27a24af..16978b0 100644 --- a/examples/server-threads/server.ts +++ b/examples/server-threads/server.ts @@ -1,11 +1,12 @@ import { createServer } from 'node:http'; +import { threadId } from 'node:worker_threads'; import { mo } from '../../src/index.ts'; import { listen, type ListenArgs } from '../../src/serve/index.ts'; export const runServer = mo(import.meta, async (...args: ListenArgs): Promise => { const srv = createServer((req, res) => { res.writeHead(200, { 'Content-Type': 'text/plain' }); - res.end(`handled by worker ${process.pid}\n`); + res.end(`handled by thread ${threadId}\n`); }); await listen(srv, ...args); }); -- 2.51.2