mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-23 09:00:28 +03:00
Feature/Add bullmq redis for message queue processing (#3568)
* add bullmq redis for message queue processing * Update pnpm-lock.yaml * update queue manager * remove singleton patterns, add redis to cache pool * add bull board ui * update rate limit handler * update redis configuration * Merge add rate limit redis prefix * update rate limit queue events * update preview loader to queue * refractor namings to constants * update env variable for queue * update worker shutdown gracefully
This commit is contained in:
@@ -43,11 +43,11 @@ class InMemoryEmbeddingCache implements INode {
|
||||
async init(nodeData: INodeData, _: string, options: ICommonObject): Promise<any> {
|
||||
const namespace = nodeData.inputs?.namespace as string
|
||||
const underlyingEmbeddings = nodeData.inputs?.embeddings as Embeddings
|
||||
const memoryMap = options.cachePool.getEmbeddingCache(options.chatflowid) ?? {}
|
||||
const memoryMap = (await options.cachePool.getEmbeddingCache(options.chatflowid)) ?? {}
|
||||
const inMemCache = new InMemoryEmbeddingCacheExtended(memoryMap)
|
||||
|
||||
inMemCache.mget = async (keys: string[]) => {
|
||||
const memory = options.cachePool.getEmbeddingCache(options.chatflowid) ?? inMemCache.store
|
||||
const memory = (await options.cachePool.getEmbeddingCache(options.chatflowid)) ?? inMemCache.store
|
||||
return keys.map((key) => memory[key])
|
||||
}
|
||||
|
||||
@@ -55,14 +55,14 @@ class InMemoryEmbeddingCache implements INode {
|
||||
for (const [key, value] of keyValuePairs) {
|
||||
inMemCache.store[key] = value
|
||||
}
|
||||
options.cachePool.addEmbeddingCache(options.chatflowid, inMemCache.store)
|
||||
await options.cachePool.addEmbeddingCache(options.chatflowid, inMemCache.store)
|
||||
}
|
||||
|
||||
inMemCache.mdelete = async (keys: string[]): Promise<void> => {
|
||||
for (const key of keys) {
|
||||
delete inMemCache.store[key]
|
||||
}
|
||||
options.cachePool.addEmbeddingCache(options.chatflowid, inMemCache.store)
|
||||
await options.cachePool.addEmbeddingCache(options.chatflowid, inMemCache.store)
|
||||
}
|
||||
|
||||
return CacheBackedEmbeddings.fromBytesStore(underlyingEmbeddings, inMemCache, {
|
||||
|
||||
Reference in New Issue
Block a user