Restructure chat service, web routes, and add test suite
Split monolithic chat service into modular structure with Matrix client support, extract web server into per-resource route modules, introduce bootstrap/main-loop separation, and add comprehensive vitest coverage across services, repositories, and utilities. Adds project docs and CLAUDE.md agent instructions.
This commit is contained in:
1 parent
dfa0580859
commit
633bb0ec04
84 files changed
+19278
-3888
No files matched your search
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* `fetch` with a hard client-side timeout. Node's global fetch otherwise
|
||||
* inherits no timeout — a stalled connection will hang the caller forever,
|
||||
* which has wedged the main loop more than once (incidents on 2026-05-20).
|
||||
*
|
||||
* On timeout, throws an error whose `.name === 'TimeoutError'`. Callers that
|
||||
* want to differentiate timeout-vs-other failures can branch on that.
|
||||
*/
|
||||
export async function fetchWithTimeout(
|
||||
input: string | URL | Request,
|
||||
init: RequestInit & { timeoutMs?: number } = {},
|
||||
): Promise<Response> {
|
||||
const { timeoutMs = 30_000, ...rest } = init;
|
||||
return fetch(input, {
|
||||
...rest,
|
||||
signal: AbortSignal.timeout(timeoutMs),
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user