mirror of
https://github.com/abhigyanpatwari/GitNexus.git
synced 2026-10-07 02:58:02 +00:00
refactor(server): reuse shared backend in /api/group-status
The handler was allocating a fresh LocalBackend (open DB connections + repo refresh) on every request and disposing it in finally. createServer already owns a shared backend for MCP; route /api/group-status through that instead so concurrent requests no longer multiply DB handles. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
f9134f1882
commit
f450a3d084
1 changed files with 2 additions and 8 deletions
|
|
@ -834,14 +834,8 @@ export const createServer = async (port: number, host: string = '127.0.0.1') =>
|
|||
return;
|
||||
}
|
||||
|
||||
const backend = new LocalBackend();
|
||||
try {
|
||||
await backend.init();
|
||||
const result = await backend.getGroupService().groupStatus({ name: groupName });
|
||||
res.json(result);
|
||||
} finally {
|
||||
await backend.dispose().catch(() => {});
|
||||
}
|
||||
const result = await backend.getGroupService().groupStatus({ name: groupName });
|
||||
res.json(result);
|
||||
} catch (err: any) {
|
||||
res.status(500).json({ error: err.message || 'Failed to get group status' });
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue