Use function instead of const for functions and dont have functions open/close redis connection
This commit is contained in:
parent
1f8c41e100
commit
8ee656c067
@ -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();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user