mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-20 11:22:15 +00:00
feat(core): Make Redis available for backend communication (#6719)
* support redis cluster * cleanup, fix config schema * set default prefix to bull * initial commit * improve logging * improve types and refactor * list support and refactor * fix redis service and tests * add comment * add redis and cache prefix * use injection * lint fix * clean schema comments * improve naming, tests, cluster client * merge master * cache returns unknown instead of T * update cache service, tests and doc * remove console.log * do not cache null or undefined values * fix merge * lint fix
This commit is contained in:
committed by
GitHub
parent
4ac4b850dd
commit
3cad60e918
30
packages/cli/src/services/redis/RedisServiceListSender.ts
Normal file
30
packages/cli/src/services/redis/RedisServiceListSender.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import { Service } from 'typedi';
|
||||
import { WORKER_RESPONSE_REDIS_LIST } from './RedisServiceHelper';
|
||||
import type { RedisServiceWorkerResponseObject } from './RedisServiceCommands';
|
||||
import { RedisServiceBaseSender } from './RedisServiceBaseClasses';
|
||||
|
||||
@Service()
|
||||
export class RedisServiceListSender extends RedisServiceBaseSender {
|
||||
async init(senderId?: string): Promise<void> {
|
||||
await super.init('list-sender');
|
||||
this.setSenderId(senderId);
|
||||
}
|
||||
|
||||
async prepend(list: string, message: string): Promise<void> {
|
||||
if (!this.redisClient) {
|
||||
await this.init();
|
||||
}
|
||||
await this.redisClient?.lpush(list, message);
|
||||
}
|
||||
|
||||
async append(list: string, message: string): Promise<void> {
|
||||
if (!this.redisClient) {
|
||||
await this.init();
|
||||
}
|
||||
await this.redisClient?.rpush(list, message);
|
||||
}
|
||||
|
||||
async appendWorkerResponse(message: RedisServiceWorkerResponseObject): Promise<void> {
|
||||
await this.prepend(WORKER_RESPONSE_REDIS_LIST, JSON.stringify(message));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user