Deprecate message queue type (#10040)
Not removing all the code for now, maybe we should 🤔
This commit is contained in:
@ -8,7 +8,7 @@ import { EnvironmentService } from 'src/engine/core-modules/environment/environm
|
||||
export const cacheStorageModuleFactory = (
|
||||
environmentService: EnvironmentService,
|
||||
): CacheModuleOptions => {
|
||||
const cacheStorageType = environmentService.get('CACHE_STORAGE_TYPE');
|
||||
const cacheStorageType = CacheStorageType.Redis;
|
||||
const cacheStorageTtl = environmentService.get('CACHE_STORAGE_TTL');
|
||||
const cacheModuleOptions: CacheModuleOptions = {
|
||||
isGlobal: true,
|
||||
@ -16,9 +16,9 @@ export const cacheStorageModuleFactory = (
|
||||
};
|
||||
|
||||
switch (cacheStorageType) {
|
||||
case CacheStorageType.Memory: {
|
||||
/* case CacheStorageType.Memory: {
|
||||
return cacheModuleOptions;
|
||||
}
|
||||
}*/
|
||||
case CacheStorageType.Redis: {
|
||||
const redisUrl = environmentService.get('REDIS_URL');
|
||||
|
||||
|
||||
@ -22,7 +22,6 @@ import { SupportDriver } from 'src/engine/core-modules/environment/interfaces/su
|
||||
import { LLMChatModelDriver } from 'src/engine/core-modules/llm-chat-model/interfaces/llm-chat-model.interface';
|
||||
import { LLMTracingDriver } from 'src/engine/core-modules/llm-tracing/interfaces/llm-tracing.interface';
|
||||
|
||||
import { CacheStorageType } from 'src/engine/core-modules/cache-storage/types/cache-storage-type.enum';
|
||||
import { CaptchaDriverType } from 'src/engine/core-modules/captcha/interfaces';
|
||||
import { CastToBoolean } from 'src/engine/core-modules/environment/decorators/cast-to-boolean.decorator';
|
||||
import { CastToLogLevelArray } from 'src/engine/core-modules/environment/decorators/cast-to-log-level-array.decorator';
|
||||
@ -37,7 +36,6 @@ import { EnvironmentVariablesSubGroup } from 'src/engine/core-modules/environmen
|
||||
import { ExceptionHandlerDriver } from 'src/engine/core-modules/exception-handler/interfaces';
|
||||
import { StorageDriverType } from 'src/engine/core-modules/file-storage/interfaces';
|
||||
import { LoggerDriverType } from 'src/engine/core-modules/logger/interfaces';
|
||||
import { MessageQueueDriverType } from 'src/engine/core-modules/message-queue/interfaces';
|
||||
import { ServerlessDriverType } from 'src/engine/core-modules/serverless/serverless.interface';
|
||||
import { assert } from 'src/utils/assert';
|
||||
|
||||
@ -760,12 +758,6 @@ export class EnvironmentVariables {
|
||||
@IsOptional()
|
||||
PG_SSL_ALLOW_SELF_SIGNED = false;
|
||||
|
||||
@EnvironmentVariablesMetadata({
|
||||
group: EnvironmentVariablesGroup.Cache,
|
||||
description: 'Cache storage type',
|
||||
})
|
||||
CACHE_STORAGE_TYPE: CacheStorageType = CacheStorageType.Redis;
|
||||
|
||||
@EnvironmentVariablesMetadata({
|
||||
group: EnvironmentVariablesGroup.Cache,
|
||||
description: 'Cache storage TTL',
|
||||
@ -779,11 +771,6 @@ export class EnvironmentVariables {
|
||||
description: 'Cache storage URL',
|
||||
})
|
||||
@IsOptional()
|
||||
@ValidateIf(
|
||||
(env) =>
|
||||
env.CACHE_STORAGE_TYPE === CacheStorageType.Redis ||
|
||||
env.MESSAGE_QUEUE_TYPE === MessageQueueDriverType.BullMQ,
|
||||
)
|
||||
@IsUrl({
|
||||
protocols: ['redis'],
|
||||
require_tld: false,
|
||||
@ -1005,12 +992,6 @@ export class EnvironmentVariables {
|
||||
@ValidateIf((env) => env.MAX_NUMBER_OF_WORKSPACES_DELETED_PER_EXECUTION > 0)
|
||||
MAX_NUMBER_OF_WORKSPACES_DELETED_PER_EXECUTION = 5;
|
||||
|
||||
@EnvironmentVariablesMetadata({
|
||||
group: EnvironmentVariablesGroup.QueueConfig,
|
||||
description: 'Queue driver type',
|
||||
})
|
||||
MESSAGE_QUEUE_TYPE: string = MessageQueueDriverType.BullMQ;
|
||||
|
||||
@EnvironmentVariablesMetadata({
|
||||
group: EnvironmentVariablesGroup.QueueConfig,
|
||||
description: 'Workflow execution throttle limit',
|
||||
|
||||
@ -3,8 +3,6 @@ import {
|
||||
BullMQDriverFactoryOptions,
|
||||
MessageQueueDriverType,
|
||||
MessageQueueModuleOptions,
|
||||
PgBossDriverFactoryOptions,
|
||||
SyncDriverFactoryOptions,
|
||||
} from 'src/engine/core-modules/message-queue/interfaces';
|
||||
import { RedisClientService } from 'src/engine/core-modules/redis-client/redis-client.service';
|
||||
|
||||
@ -17,9 +15,10 @@ export const messageQueueModuleFactory = async (
|
||||
environmentService: EnvironmentService,
|
||||
redisClientService: RedisClientService,
|
||||
): Promise<MessageQueueModuleOptions> => {
|
||||
const driverType = environmentService.get('MESSAGE_QUEUE_TYPE');
|
||||
const driverType = MessageQueueDriverType.BullMQ;
|
||||
|
||||
switch (driverType) {
|
||||
/*
|
||||
case MessageQueueDriverType.Sync: {
|
||||
return {
|
||||
type: MessageQueueDriverType.Sync,
|
||||
@ -35,7 +34,7 @@ export const messageQueueModuleFactory = async (
|
||||
connectionString,
|
||||
},
|
||||
} satisfies PgBossDriverFactoryOptions;
|
||||
}
|
||||
}*/
|
||||
case MessageQueueDriverType.BullMQ: {
|
||||
return {
|
||||
type: MessageQueueDriverType.BullMQ,
|
||||
|
||||
@ -1,16 +1,14 @@
|
||||
import { Logger } from '@nestjs/common';
|
||||
|
||||
import { createClient } from 'redis';
|
||||
import RedisStore from 'connect-redis';
|
||||
import session from 'express-session';
|
||||
import { createClient } from 'redis';
|
||||
|
||||
import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service';
|
||||
import { CacheStorageType } from 'src/engine/core-modules/cache-storage/types/cache-storage-type.enum';
|
||||
import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service';
|
||||
|
||||
export const getSessionStorageOptions = (
|
||||
environmentService: EnvironmentService,
|
||||
): session.SessionOptions => {
|
||||
const cacheStorageType = environmentService.get('CACHE_STORAGE_TYPE');
|
||||
const cacheStorageType = CacheStorageType.Redis;
|
||||
|
||||
const SERVER_URL = environmentService.get('SERVER_URL');
|
||||
|
||||
@ -26,13 +24,13 @@ export const getSessionStorageOptions = (
|
||||
};
|
||||
|
||||
switch (cacheStorageType) {
|
||||
case CacheStorageType.Memory: {
|
||||
/* case CacheStorageType.Memory: {
|
||||
Logger.warn(
|
||||
'Memory session storage is not recommended for production. Prefer Redis.',
|
||||
);
|
||||
|
||||
return sessionStorage;
|
||||
}
|
||||
}*/
|
||||
case CacheStorageType.Redis: {
|
||||
const connectionString = environmentService.get('REDIS_URL');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user