From 8ee656c06798865c64eaea018706edb36bfe7638 Mon Sep 17 00:00:00 2001 From: Apher Date: Mon, 6 Jul 2026 23:45:06 +0000 Subject: [PATCH] Use function instead of const for functions and dont have functions open/close redis connection --- src/server.js | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/server.js b/src/server.js index 96de790..989a9e2 100644 --- a/src/server.js +++ b/src/server.js @@ -32,9 +32,7 @@ const sendTranscriptEvent = async (streamKey, device_id, text) => { } // Read Redis Stream group -const processor = async (group, consumer, streamKey) => { - await redis.client.connect().catch(console.error); - +async function processor (group, consumer, streamKey) { while (true) { const res = await redis.client.xReadGroup( group, @@ -53,12 +51,11 @@ const processor = async (group, consumer, streamKey) => { } } } - - await redis.client.quit(); } -const main = async () => { - await redis.ensureGroup("commands", 'assistant'); +async function main() { + await redis.client.connect().catch(console.error); + await redis.ensureGroup("commands", "assistant"); py.stdout.on('data', (data) => { buffer += data.toString();