Separate app construction from server startup

buildApp() returns the configured Fastify instance without listening, so
tests can drive it with inject(). Shutdown of database, Redis and queue
connections now lives in one place shared by the server and worker.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MzFywujuH9TiuXbr9vjoX8
This commit is contained in:
2026-10-03 11:28:17 -04:00
co-authored by Claude Opus 5.5
parent 0122a93212
commit 95cd740e51
5 changed files with 84 additions and 60 deletions
+5
View File
@@ -9,6 +9,11 @@ export const RESOLVE_QUEUE = 'resolve-track';
export const pollQueue = new Queue<{ connectionId: string }>(POLL_QUEUE, { connection });
export const resolveQueue = new Queue<{ trackId: string }>(RESOLVE_QUEUE, { connection });
export async function closeQueues() {
await Promise.all([pollQueue.close(), resolveQueue.close()]);
await connection.quit();
}
export function enqueueResolve(trackId: string) {
return resolveQueue.add(
'resolve',