Compare commits
2 Commits
a089a92205
...
e7cf1fa022
| Author | SHA1 | Date | |
|---|---|---|---|
| e7cf1fa022 | |||
|
8a533d028d
|
@@ -873,8 +873,8 @@ if (cluster.isPrimary) {
|
||||
});
|
||||
} else {
|
||||
// ── Worker: cada uno tiene su propio McpServer singleton ──
|
||||
// El mutex serializa las requests dentro de este worker (stateless, 1 request a la vez por worker)
|
||||
let workerBusy: Promise<void> = Promise.resolve();
|
||||
// Sin mutex: cada request se atiende concurrentemente dentro del worker.
|
||||
// StreamableHTTPServerTransport es stateless (uno por request), sin estado compartido.
|
||||
|
||||
async function handleMcpRequest(req: IncomingMessage, res: ServerResponse): Promise<void> {
|
||||
const transport = new StreamableHTTPServerTransport({
|
||||
@@ -893,9 +893,7 @@ if (cluster.isPrimary) {
|
||||
res.writeHead(404).end("Not found");
|
||||
return;
|
||||
}
|
||||
workerBusy = workerBusy
|
||||
.then(() => handleMcpRequest(req, res))
|
||||
.catch((err) => {
|
||||
handleMcpRequest(req, res).catch((err) => {
|
||||
console.error(`[docmost-mcp] Worker PID=${process.pid} error:`, err);
|
||||
if (!res.headersSent) {
|
||||
res.writeHead(500, { "Content-Type": "application/json" }).end(
|
||||
|
||||
@@ -67,7 +67,7 @@ export async function updatePageContentRealtime(
|
||||
const timer = setTimeout(() => {
|
||||
if (provider) provider.destroy();
|
||||
reject(new Error("Connection timeout to collaboration server"));
|
||||
}, 25000);
|
||||
}, 120000);
|
||||
|
||||
const provider = new HocuspocusProvider({
|
||||
url: wsUrl,
|
||||
|
||||
Reference in New Issue
Block a user