mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 18:41:14 +00:00
fix(core): Change VariablesService to DI and use caching (#6827)
* 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 * VariablesService as DI, add caching, fix tests * do not cache null or undefined values * import fix * more DI and remove collections * fix merge * lint fix * rename to ~Cached * fix test for CI * fix ActiveWorkflowRunner test
This commit is contained in:
committed by
GitHub
parent
41d8a18d47
commit
659ca26fe7
@@ -37,6 +37,7 @@ import { isWorkflowIdValid } from './utils';
|
||||
import { UserService } from './user/user.service';
|
||||
import type { SharedWorkflow } from '@db/entities/SharedWorkflow';
|
||||
import type { RoleNames } from '@db/entities/Role';
|
||||
import { VariablesService } from './environments/variables/variables.service';
|
||||
|
||||
const ERROR_TRIGGER_TYPE = config.getEnv('nodes.errorTriggerType');
|
||||
|
||||
@@ -571,8 +572,9 @@ export function validateWorkflowCredentialUsage(
|
||||
}
|
||||
|
||||
export async function getVariables(): Promise<IDataObject> {
|
||||
const variables = await Container.get(VariablesService).getAllCached();
|
||||
return Object.freeze(
|
||||
(await Db.collections.Variables.find()).reduce((prev, curr) => {
|
||||
variables.reduce((prev, curr) => {
|
||||
prev[curr.key] = curr.value;
|
||||
return prev;
|
||||
}, {} as IDataObject),
|
||||
|
||||
Reference in New Issue
Block a user