Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

Merge pull request #6442 from Infisical/feature/move-cron-out-of-bullmq

Victor Hugo dos Santos886ac44d566a
diff --cc backend/src/ee/services/pam-discovery/pam-discovery-queue.ts
index ea9600b447,8002b39a80..7ac566bd22
--- a/backend/src/ee/services/pam-discovery/pam-discovery-queue.ts
+++ b/backend/src/ee/services/pam-discovery/pam-discovery-queue.ts
@@@ -1,8 -1,8 +1,9 @@@
+import { TGatewayPoolServiceFactory } from "@app/ee/services/gateway-pool/gateway-pool-service";
import { TGatewayV2DALFactory } from "@app/ee/services/gateway-v2/gateway-v2-dal";
import { TGatewayV2ServiceFactory } from "@app/ee/services/gateway-v2/gateway-v2-service";
+ import { CronJobName, TCronJobFactory } from "@app/lib/cron/cron-job";
import { logger } from "@app/lib/logger";
- import { JOB_SCHEDULER_PREFIX, QueueJobs, QueueName, TQueueServiceFactory } from "@app/queue/queue-service";
+ import { QueueJobs, QueueName, TQueueServiceFactory } from "@app/queue/queue-service";
import { TKmsServiceFactory } from "@app/services/kms/kms-service";
import { TPamAccountDALFactory } from "../pam-account/pam-account-dal";
@@@ -34,9 -34,9 +35,10 @@@ type TPamDiscoveryQueueFactoryDep =
pamAccountDAL: Pick<TPamAccountDALFactory, "create" | "find" | "updateById" | "transaction">;
kmsService: Pick<TKmsServiceFactory, "createCipherPairWithDataKey">;
queueService: TQueueServiceFactory;
+ cronJob: TCronJobFactory;
gatewayV2Service: Pick<TGatewayV2ServiceFactory, "getPlatformConnectionDetailsByGatewayId">;
gatewayV2DAL: Pick<TGatewayV2DALFactory, "findById">;
+ gatewayPoolService: Pick<TGatewayPoolServiceFactory, "resolveEffectiveGatewayId">;
};
export type TPamDiscoveryQueueFactory = ReturnType<typeof pamDiscoveryQueueFactory>;
@@@ -53,9 -53,9 +55,10 @@@ export const pamDiscoveryQueueFactory
pamAccountDAL,
kmsService,
queueService,
+ cronJob,
gatewayV2Service,
- gatewayV2DAL
+ gatewayV2DAL,
+ gatewayPoolService
}: TPamDiscoveryQueueFactoryDep) => {
const startPamDiscoveryQueue = () => {
queueService.start(QueueName.PamDiscoveryScan, async (job) => {
diff --cc backend/src/ee/services/pki-discovery/pki-discovery-queue.ts
index 7bcbb0e573,f8fe5b2c47..a5def127ba
--- a/backend/src/ee/services/pki-discovery/pki-discovery-queue.ts
+++ b/backend/src/ee/services/pki-discovery/pki-discovery-queue.ts
@@@ -1,8 -1,8 +1,9 @@@
+import { TGatewayPoolServiceFactory } from "@app/ee/services/gateway-pool/gateway-pool-service";
import { TGatewayV2DALFactory } from "@app/ee/services/gateway-v2/gateway-v2-dal";
import { TGatewayV2ServiceFactory } from "@app/ee/services/gateway-v2/gateway-v2-service";
+ import { CronJobName, TCronJobFactory } from "@app/lib/cron/cron-job";
import { logger } from "@app/lib/logger";
- import { JOB_SCHEDULER_PREFIX, QueueJobs, QueueName, TQueueServiceFactory } from "@app/queue/queue-service";
+ import { QueueJobs, QueueName, TQueueServiceFactory } from "@app/queue/queue-service";
import { TCertificateBodyDALFactory } from "@app/services/certificate/certificate-body-dal";
import { TCertificateDALFactory } from "@app/services/certificate/certificate-dal";
import { TKmsServiceFactory } from "@app/services/kms/kms-service";
@@@ -27,9 -27,9 +28,10 @@@ type TPkiDiscoveryQueueFactoryDep =
projectDAL: Pick<TProjectDALFactory, "findOne" | "updateById" | "transaction">;
kmsService: Pick<TKmsServiceFactory, "encryptWithKmsKey" | "generateKmsKey">;
queueService: TQueueServiceFactory;
+ cronJob: TCronJobFactory;
gatewayV2Service: Pick<TGatewayV2ServiceFactory, "getPlatformConnectionDetailsByGatewayId">;
gatewayV2DAL: Pick<TGatewayV2DALFactory, "findById">;
+ gatewayPoolService: Pick<TGatewayPoolServiceFactory, "resolveEffectiveGatewayId">;
};
export type TPkiDiscoveryQueueFactory = ReturnType<typeof pkiDiscoveryQueueFactory>;
@@@ -45,9 -45,9 +47,10 @@@ export const pkiDiscoveryQueueFactory
projectDAL,
kmsService,
queueService,
+ cronJob,
gatewayV2Service,
- gatewayV2DAL
+ gatewayV2DAL,
+ gatewayPoolService
}: TPkiDiscoveryQueueFactoryDep) => {
const startPkiDiscoveryScanQueue = () => {
queueService.start(QueueName.PkiDiscoveryScan, async (job) => {
diff --cc backend/src/server/routes/index.ts
index 79abd383d1,767b73d745..b8af8bb878
--- a/backend/src/server/routes/index.ts
+++ b/backend/src/server/routes/index.ts
@@@ -2867,9 -2859,9 +2879,10 @@@ export const registerRoutes = async
projectDAL,
kmsService,
queueService,
+ cronJob,
gatewayV2Service,
- gatewayV2DAL
+ gatewayV2DAL,
+ gatewayPoolService
});
const pkiDiscoveryService = pkiDiscoveryServiceFactory({
@@@ -3144,9 -3133,9 +3159,10 @@@
pamAccountDAL,
kmsService,
queueService,
+ cronJob,
gatewayV2Service,
- gatewayV2DAL
+ gatewayV2DAL,
+ gatewayPoolService
});
const pamDiscoverySourceService = pamDiscoverySourceServiceFactory({