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
@@ -25,6 +25,7 @@ import {
|
||||
import type { WorkflowEntity } from '@db/entities/WorkflowEntity';
|
||||
import { In } from 'typeorm';
|
||||
import type { SourceControlledFile } from './types/sourceControlledFile';
|
||||
import { VariablesService } from '../variables/variables.service';
|
||||
|
||||
@Service()
|
||||
export class SourceControlExportService {
|
||||
@@ -34,7 +35,7 @@ export class SourceControlExportService {
|
||||
|
||||
private credentialExportFolder: string;
|
||||
|
||||
constructor() {
|
||||
constructor(private readonly variablesService: VariablesService) {
|
||||
const userFolder = UserSettings.getUserN8nFolderPath();
|
||||
this.gitFolder = path.join(userFolder, SOURCE_CONTROL_GIT_FOLDER);
|
||||
this.workflowExportFolder = path.join(this.gitFolder, SOURCE_CONTROL_WORKFLOW_EXPORT_FOLDER);
|
||||
@@ -136,7 +137,7 @@ export class SourceControlExportService {
|
||||
async exportVariablesToWorkFolder(): Promise<ExportResult> {
|
||||
try {
|
||||
sourceControlFoldersExistCheck([this.gitFolder]);
|
||||
const variables = await Db.collections.Variables.find();
|
||||
const variables = await this.variablesService.getAllCached();
|
||||
// do not export empty variables
|
||||
if (variables.length === 0) {
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user