mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-20 19:32:15 +00:00
ci(core): Reduce memory usage in tests (part-2) (no-changelog) (#7671)
This also gets rid of `Db.collection`, which was another source of circular dependencies.
This commit is contained in:
committed by
GitHub
parent
37dd658dc5
commit
000e76e3b4
@@ -4,7 +4,6 @@ import { InstanceSettings, ObjectStoreService } from 'n8n-core';
|
||||
import Container, { Service } from 'typedi';
|
||||
import { Logger } from '@/Logger';
|
||||
import config from '@/config';
|
||||
import * as Db from '@/Db';
|
||||
import {
|
||||
LICENSE_FEATURES,
|
||||
LICENSE_QUOTAS,
|
||||
@@ -12,7 +11,8 @@ import {
|
||||
SETTINGS_LICENSE_CERT_KEY,
|
||||
UNLIMITED_LICENSE_QUOTA,
|
||||
} from './constants';
|
||||
import { WorkflowRepository } from '@/databases/repositories';
|
||||
import { SettingsRepository } from '@db/repositories/settings.repository';
|
||||
import { WorkflowRepository } from '@db/repositories/workflow.repository';
|
||||
import type { BooleanLicenseFeature, N8nInstanceType, NumericLicenseFeature } from './Interfaces';
|
||||
import type { RedisServicePubSubPublisher } from './services/redis/RedisServicePubSubPublisher';
|
||||
import { RedisService } from './services/redis.service';
|
||||
@@ -40,6 +40,8 @@ export class License {
|
||||
constructor(
|
||||
private readonly logger: Logger,
|
||||
private readonly instanceSettings: InstanceSettings,
|
||||
private readonly settingsRepository: SettingsRepository,
|
||||
private readonly workflowRepository: WorkflowRepository,
|
||||
) {}
|
||||
|
||||
async init(instanceType: N8nInstanceType = 'main') {
|
||||
@@ -91,7 +93,7 @@ export class License {
|
||||
return [
|
||||
{
|
||||
name: 'activeWorkflows',
|
||||
value: await Container.get(WorkflowRepository).count({ where: { active: true } }),
|
||||
value: await this.workflowRepository.count({ where: { active: true } }),
|
||||
},
|
||||
];
|
||||
}
|
||||
@@ -102,7 +104,7 @@ export class License {
|
||||
if (ephemeralLicense) {
|
||||
return ephemeralLicense;
|
||||
}
|
||||
const databaseSettings = await Db.collections.Settings.findOne({
|
||||
const databaseSettings = await this.settingsRepository.findOne({
|
||||
where: {
|
||||
key: SETTINGS_LICENSE_CERT_KEY,
|
||||
},
|
||||
@@ -153,7 +155,7 @@ export class License {
|
||||
async saveCertStr(value: TLicenseBlock): Promise<void> {
|
||||
// if we have an ephemeral license, we don't want to save it to the database
|
||||
if (config.get('license.cert')) return;
|
||||
await Db.collections.Settings.upsert(
|
||||
await this.settingsRepository.upsert(
|
||||
{
|
||||
key: SETTINGS_LICENSE_CERT_KEY,
|
||||
value,
|
||||
|
||||
Reference in New Issue
Block a user