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:
Michael Auerswald
2023-08-02 14:51:09 +02:00
committed by GitHub
parent 41d8a18d47
commit 659ca26fe7
11 changed files with 99 additions and 51 deletions

View File

@@ -9,6 +9,7 @@ import {
VariablesValidationError,
} from './variables.service.ee';
import { isVariablesEnabled } from './enviromentHelpers';
import Container from 'typedi';
// eslint-disable-next-line @typescript-eslint/naming-convention
export const EEVariablesController = express.Router();
@@ -37,7 +38,7 @@ EEVariablesController.post(
const variable = req.body;
delete variable.id;
try {
return await EEVariablesService.create(variable);
return await Container.get(EEVariablesService).create(variable);
} catch (error) {
if (error instanceof VariablesLicenseError) {
throw new ResponseHelper.BadRequestError(error.message);
@@ -63,7 +64,7 @@ EEVariablesController.patch(
const variable = req.body;
delete variable.id;
try {
return await EEVariablesService.update(id, variable);
return await Container.get(EEVariablesService).update(id, variable);
} catch (error) {
if (error instanceof VariablesLicenseError) {
throw new ResponseHelper.BadRequestError(error.message);