From 9049f7729a8495d5b39d66cb25de25b96db3c437 Mon Sep 17 00:00:00 2001 From: Anze Demsar Date: Fri, 13 Sep 2024 19:32:54 +0200 Subject: [PATCH 1/2] add environment to queue name --- src/activities/activities.module.ts | 3 ++- src/app.module.ts | 3 ++- src/audit/audit.module.ts | 3 ++- src/crags/crags.module.ts | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/activities/activities.module.ts b/src/activities/activities.module.ts index 3636606..ce05fce 100644 --- a/src/activities/activities.module.ts +++ b/src/activities/activities.module.ts @@ -20,6 +20,7 @@ import { Sector } from '../crags/entities/sector.entity'; import { Country } from '../crags/entities/country.entity'; import { BullModule } from '@nestjs/bull'; import { CragsModule } from '../crags/crags.module'; +import { env } from 'process'; @Module({ imports: [ @@ -39,7 +40,7 @@ import { CragsModule } from '../crags/crags.module'; forwardRef(() => AuditModule), // because audit module is imported in usersmodule and this constitutes a circular dependency (users->audit->activities->users...) forwardRef(() => UsersModule), BullModule.registerQueue({ - name: 'summary', + name: `${env.ENVIRONMENT}-summary`, }), CragsModule, ], diff --git a/src/app.module.ts b/src/app.module.ts index 8fc5c3f..4ad91bf 100644 --- a/src/app.module.ts +++ b/src/app.module.ts @@ -44,6 +44,7 @@ import EntityCacheSubscriber from './core/utils/entity-cache/entity-cache.subscr import { SnakeNamingStrategy } from 'typeorm-naming-strategies'; import { BullModule } from '@nestjs/bull'; import { Parking } from './crags/entities/parking.entity'; +import { env } from 'process'; @Module({ imports: [ @@ -133,7 +134,7 @@ import { Parking } from './crags/entities/parking.entity'; inject: [ConfigService], }), BullModule.registerQueue({ - name: 'summary', + name: `${env.ENVIRONMENT}-summary`, }), ], providers: [], diff --git a/src/audit/audit.module.ts b/src/audit/audit.module.ts index badca3a..7d24095 100644 --- a/src/audit/audit.module.ts +++ b/src/audit/audit.module.ts @@ -21,6 +21,7 @@ import { ActivityRoute } from '../activities/entities/activity-route.entity'; import { BullModule } from '@nestjs/bull'; import { UsersModule } from '../users/users.module'; import { CragsModule } from '../crags/crags.module'; +import { env } from 'process'; @Module({ imports: [ @@ -40,7 +41,7 @@ import { CragsModule } from '../crags/crags.module'; ]), AuthModule, BullModule.registerQueue({ - name: 'summary', + name: `${env.ENVIRONMENT}-summary`, }), forwardRef(() => UsersModule), forwardRef(() => CragsModule), diff --git a/src/crags/crags.module.ts b/src/crags/crags.module.ts index 1bcb273..6ed4dba 100644 --- a/src/crags/crags.module.ts +++ b/src/crags/crags.module.ts @@ -71,6 +71,7 @@ import { RouteEvent } from './entities/route-event.entity'; import { Parking } from './entities/parking.entity'; import { ParkingsService } from './services/parkings.service'; import { AreaLoader } from './loaders/area.loader'; +import { env } from 'process'; @Module({ imports: [ @@ -101,7 +102,7 @@ import { AreaLoader } from './loaders/area.loader'; ]), forwardRef(() => AuditModule), BullModule.registerQueue({ - name: 'summary', + name: `${env.ENVIRONMENT}-summary`, }), ], providers: [ From d57204379cf93575573a9656a8b36270bdcdf662 Mon Sep 17 00:00:00 2001 From: Anze Demsar Date: Fri, 13 Sep 2024 19:56:25 +0200 Subject: [PATCH 2/2] add queue prefix for bull --- src/activities/activities.module.ts | 3 ++- src/app.module.ts | 3 ++- src/audit/audit.module.ts | 3 ++- src/crags/crags.module.ts | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/activities/activities.module.ts b/src/activities/activities.module.ts index ce05fce..4de3553 100644 --- a/src/activities/activities.module.ts +++ b/src/activities/activities.module.ts @@ -40,7 +40,8 @@ import { env } from 'process'; forwardRef(() => AuditModule), // because audit module is imported in usersmodule and this constitutes a circular dependency (users->audit->activities->users...) forwardRef(() => UsersModule), BullModule.registerQueue({ - name: `${env.ENVIRONMENT}-summary`, + name: 'summary', + prefix: `bull:${env.ENVIRONMENT}`, }), CragsModule, ], diff --git a/src/app.module.ts b/src/app.module.ts index 4ad91bf..ba06cb9 100644 --- a/src/app.module.ts +++ b/src/app.module.ts @@ -134,7 +134,8 @@ import { env } from 'process'; inject: [ConfigService], }), BullModule.registerQueue({ - name: `${env.ENVIRONMENT}-summary`, + name: 'summary', + prefix: `bull:${env.ENVIRONMENT}`, }), ], providers: [], diff --git a/src/audit/audit.module.ts b/src/audit/audit.module.ts index 7d24095..6ead5f0 100644 --- a/src/audit/audit.module.ts +++ b/src/audit/audit.module.ts @@ -41,7 +41,8 @@ import { env } from 'process'; ]), AuthModule, BullModule.registerQueue({ - name: `${env.ENVIRONMENT}-summary`, + name: 'summary', + prefix: `bull:${env.ENVIRONMENT}`, }), forwardRef(() => UsersModule), forwardRef(() => CragsModule), diff --git a/src/crags/crags.module.ts b/src/crags/crags.module.ts index 6ed4dba..e342f18 100644 --- a/src/crags/crags.module.ts +++ b/src/crags/crags.module.ts @@ -102,7 +102,8 @@ import { env } from 'process'; ]), forwardRef(() => AuditModule), BullModule.registerQueue({ - name: `${env.ENVIRONMENT}-summary`, + name: 'summary', + prefix: `bull:${env.ENVIRONMENT}`, }), ], providers: [