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();