Fix: Patching redis socket crash fix (#4431)
* redis keepalive mechanism for all redis * removed offline queue commands * Simplified changes for consistency. Added REDIS_KEEP_ALIVE env variable. * update redis socket alive env variable * lint fix * put pingInterval back again because it's needed * removed comment * linting --------- Co-authored-by: Henry <hzj94@hotmail.com> Co-authored-by: Henry Heng <henryheng@flowiseai.com>
This commit is contained in:
parent
7e7ff24941
commit
4326cbe6b5
|
|
@ -153,8 +153,12 @@ class Redis_VectorStores implements INode {
|
||||||
keepAlive:
|
keepAlive:
|
||||||
process.env.REDIS_KEEP_ALIVE && !isNaN(parseInt(process.env.REDIS_KEEP_ALIVE, 10))
|
process.env.REDIS_KEEP_ALIVE && !isNaN(parseInt(process.env.REDIS_KEEP_ALIVE, 10))
|
||||||
? parseInt(process.env.REDIS_KEEP_ALIVE, 10)
|
? parseInt(process.env.REDIS_KEEP_ALIVE, 10)
|
||||||
: undefined // milliseconds
|
: undefined
|
||||||
}
|
},
|
||||||
|
pingInterval:
|
||||||
|
process.env.REDIS_KEEP_ALIVE && !isNaN(parseInt(process.env.REDIS_KEEP_ALIVE, 10))
|
||||||
|
? parseInt(process.env.REDIS_KEEP_ALIVE, 10)
|
||||||
|
: undefined // Add Redis protocol-level pings
|
||||||
})
|
})
|
||||||
await redisClient.connect()
|
await redisClient.connect()
|
||||||
|
|
||||||
|
|
@ -226,8 +230,12 @@ class Redis_VectorStores implements INode {
|
||||||
keepAlive:
|
keepAlive:
|
||||||
process.env.REDIS_KEEP_ALIVE && !isNaN(parseInt(process.env.REDIS_KEEP_ALIVE, 10))
|
process.env.REDIS_KEEP_ALIVE && !isNaN(parseInt(process.env.REDIS_KEEP_ALIVE, 10))
|
||||||
? parseInt(process.env.REDIS_KEEP_ALIVE, 10)
|
? parseInt(process.env.REDIS_KEEP_ALIVE, 10)
|
||||||
: undefined // milliseconds
|
: undefined
|
||||||
}
|
},
|
||||||
|
pingInterval:
|
||||||
|
process.env.REDIS_KEEP_ALIVE && !isNaN(parseInt(process.env.REDIS_KEEP_ALIVE, 10))
|
||||||
|
? parseInt(process.env.REDIS_KEEP_ALIVE, 10)
|
||||||
|
: undefined // Add Redis protocol-level pings
|
||||||
})
|
})
|
||||||
|
|
||||||
const storeConfig: RedisVectorStoreConfig = {
|
const storeConfig: RedisVectorStoreConfig = {
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,11 @@ export class RedisEventPublisher implements IServerSideEventStreamer {
|
||||||
process.env.REDIS_KEEP_ALIVE && !isNaN(parseInt(process.env.REDIS_KEEP_ALIVE, 10))
|
process.env.REDIS_KEEP_ALIVE && !isNaN(parseInt(process.env.REDIS_KEEP_ALIVE, 10))
|
||||||
? parseInt(process.env.REDIS_KEEP_ALIVE, 10)
|
? parseInt(process.env.REDIS_KEEP_ALIVE, 10)
|
||||||
: undefined
|
: undefined
|
||||||
}
|
},
|
||||||
|
pingInterval:
|
||||||
|
process.env.REDIS_KEEP_ALIVE && !isNaN(parseInt(process.env.REDIS_KEEP_ALIVE, 10))
|
||||||
|
? parseInt(process.env.REDIS_KEEP_ALIVE, 10)
|
||||||
|
: undefined
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
this.redisPublisher = createClient({
|
this.redisPublisher = createClient({
|
||||||
|
|
@ -30,7 +34,11 @@ export class RedisEventPublisher implements IServerSideEventStreamer {
|
||||||
process.env.REDIS_KEEP_ALIVE && !isNaN(parseInt(process.env.REDIS_KEEP_ALIVE, 10))
|
process.env.REDIS_KEEP_ALIVE && !isNaN(parseInt(process.env.REDIS_KEEP_ALIVE, 10))
|
||||||
? parseInt(process.env.REDIS_KEEP_ALIVE, 10)
|
? parseInt(process.env.REDIS_KEEP_ALIVE, 10)
|
||||||
: undefined
|
: undefined
|
||||||
}
|
},
|
||||||
|
pingInterval:
|
||||||
|
process.env.REDIS_KEEP_ALIVE && !isNaN(parseInt(process.env.REDIS_KEEP_ALIVE, 10))
|
||||||
|
? parseInt(process.env.REDIS_KEEP_ALIVE, 10)
|
||||||
|
: undefined
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,11 @@ export class RedisEventSubscriber {
|
||||||
process.env.REDIS_KEEP_ALIVE && !isNaN(parseInt(process.env.REDIS_KEEP_ALIVE, 10))
|
process.env.REDIS_KEEP_ALIVE && !isNaN(parseInt(process.env.REDIS_KEEP_ALIVE, 10))
|
||||||
? parseInt(process.env.REDIS_KEEP_ALIVE, 10)
|
? parseInt(process.env.REDIS_KEEP_ALIVE, 10)
|
||||||
: undefined
|
: undefined
|
||||||
}
|
},
|
||||||
|
pingInterval:
|
||||||
|
process.env.REDIS_KEEP_ALIVE && !isNaN(parseInt(process.env.REDIS_KEEP_ALIVE, 10))
|
||||||
|
? parseInt(process.env.REDIS_KEEP_ALIVE, 10)
|
||||||
|
: undefined
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
this.redisSubscriber = createClient({
|
this.redisSubscriber = createClient({
|
||||||
|
|
@ -32,7 +36,11 @@ export class RedisEventSubscriber {
|
||||||
process.env.REDIS_KEEP_ALIVE && !isNaN(parseInt(process.env.REDIS_KEEP_ALIVE, 10))
|
process.env.REDIS_KEEP_ALIVE && !isNaN(parseInt(process.env.REDIS_KEEP_ALIVE, 10))
|
||||||
? parseInt(process.env.REDIS_KEEP_ALIVE, 10)
|
? parseInt(process.env.REDIS_KEEP_ALIVE, 10)
|
||||||
: undefined
|
: undefined
|
||||||
}
|
},
|
||||||
|
pingInterval:
|
||||||
|
process.env.REDIS_KEEP_ALIVE && !isNaN(parseInt(process.env.REDIS_KEEP_ALIVE, 10))
|
||||||
|
? parseInt(process.env.REDIS_KEEP_ALIVE, 10)
|
||||||
|
: undefined
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
this.sseStreamer = sseStreamer
|
this.sseStreamer = sseStreamer
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue