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:
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user