Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
refactor: remove queue-jobs DAL and related persistence logic, update queue service to use BullMQ
Victor Hugo dos Santos1dd2bbc4af07
diff --git a/backend/CLAUDE.md b/backend/CLAUDE.mdindex b6aff682cd..7ea435a222 100644--- a/backend/CLAUDE.md+++ b/backend/CLAUDE.md@@ -128,7 +128,7 @@ Built-in roles: `Admin`, `Member`, `Viewer`, `NoAccess`. Custom roles use unpackQueue infrastructure in `src/queue/queue-service.ts`. Defines 30+ named queues via `QueueName` enum (e.g., `SecretRotation`, `AuditLog`, `IntegrationSync`, `SecretReplication`, `SecretSync`, `DynamicSecretRevocation`). Each queue has typed payloads defined in `TQueueJobTypes`.-Queue jobs support: delays, attempts with exponential/fixed backoff, cron-pattern repeats, and completion/failure cleanup. A `PersistenceQueueStatus` enum tracks durable job states (`Pending`, `Processing`, `Completed`, `Failed`, `Stuck`, `Dead`).+Queue jobs support: delays, attempts with exponential/fixed backoff, cron-pattern repeats, and completion/failure cleanup.Queue handler factories (e.g., `src/services/secret/secret-queue.ts`) follow the same DI pattern as services — they receive DALs and services as dependencies.diff --git a/backend/e2e-test/vitest-environment-knex.ts b/backend/e2e-test/vitest-environment-knex.tsindex d27980b0f2..b0d13b8bfb 100644--- a/backend/e2e-test/vitest-environment-knex.ts+++ b/backend/e2e-test/vitest-environment-knex.ts@@ -23,7 +23,6 @@ import { superAdminDALFactory } from "@app/services/super-admin/super-admin-dal"import { bootstrapCheck } from "@app/server/boot-strap-check";import { hsmServiceFactory } from "@app/ee/services/hsm/hsm-service";import { kmsRootConfigDALFactory } from "@app/services/kms/kms-root-config-dal";-import { queueJobsDALFactory } from "@app/queue/queue-jobs-dal";dotenv.config({ path: path.join(__dirname, "../../.env.test"), debug: true });export default {@@ -76,13 +75,10 @@ export default {});const smtp = mockSmtpServer();- const queueJobsDAL = queueJobsDALFactory(db);- const queue = queueServiceFactory(envCfg, queueJobsDAL);+ const queue = queueServiceFactory(envCfg);const keyValueStoreDAL = keyValueStoreDALFactory(db);const keyStore = keyStoreFactory(envCfg, keyValueStoreDAL);- await queue.initialize();-const server = await main({db,smtp,diff --git a/backend/package-lock.json b/backend/package-lock.jsonindex 44b1f50150..0ecc6775d4 100644--- a/backend/package-lock.json+++ b/backend/package-lock.json@@ -124,7 +124,6 @@"passport-ldapauth": "^3.0.1","passport-oauth2": "^1.8.0","pg": "^8.11.3",- "pg-boss": "^10.1.5","pg-query-stream": "^4.5.3","pg-types": "^2.2.0","picomatch": "^3.0.1",@@ -3970,7 +3969,6 @@"resolved": "https://registry.npmjs.org/@aws-sdk/client-sts/-/client-sts-3.637.0.tgz","integrity": "sha512-xUi7x4qDubtA8QREtlblPuAcn91GS/09YVEY/RwU7xCY0aqGuFwgszAANlha4OUIqva8oVj2WO4gJuG+iaSnhw==","license": "Apache-2.0",- "peer": true,"dependencies": {"@aws-crypto/sha256-browser": "5.2.0","@aws-crypto/sha256-js": "5.2.0",@@ -8841,7 +8839,6 @@"version": "3.632.0","resolved": "https://registry.npmjs.org/@aws-sdk/client-sso-oidc/-/client-sso-oidc-3.632.0.tgz","integrity": "sha512-Oh1fIWaoZluihOCb/zDEpRTi+6an82fgJz7fyRBugyLhEtDjmvpCQ3oKjzaOhoN+4EvXAm1ZS/ZgpvXBlIRTgw==",- "peer": true,"dependencies": {"@aws-crypto/sha256-browser": "5.2.0","@aws-crypto/sha256-js": "5.2.0",@@ -8918,7 +8915,6 @@"version": "3.632.0","resolved": "https://registry.npmjs.org/@aws-sdk/client-sts/-/client-sts-3.632.0.tgz","integrity": "sha512-Ss5cBH09icpTvT+jtGGuQlRdwtO7RyE9BF4ZV/CEPATdd9whtJt4Qxdya8BUnkWR7h5HHTrQHqai3YVYjku41A==",- "peer": true,"dependencies": {"@aws-crypto/sha256-browser": "5.2.0","@aws-crypto/sha256-js": "5.2.0",@@ -13222,7 +13218,6 @@"integrity": "sha512-vMqyb7XCDMPvJFFOaT9kxtiRh42GwlZEg1/uIgtZshS5a/8OaduUfCi7kynKgc3Tw/6Uo2D+db9qBttghhmxwQ==","dev": true,"license": "MIT",- "peer": true,"dependencies": {"@ampproject/remapping": "^2.2.0","@babel/code-frame": "^7.26.2",@@ -15272,7 +15267,6 @@"url": "https://opencollective.com/csstools"}],- "peer": true,"engines": {"node": ">=18"},@@ -15294,7 +15288,6 @@"url": "https://opencollective.com/csstools"}],- "peer": true,"engines": {"node": ">=18"}@@ -17223,9 +17216,6 @@"win32"]},- "node_modules/@infisical/quic/node_modules/@infisical/quic-linux-arm": {- "optional": true- },"node_modules/@ioredis/commands": {"version": "1.5.0","resolved": "https://registry.npmjs.org/@ioredis/commands/-/commands-1.5.0.tgz",@@ -17948,7 +17938,6 @@"resolved": "https://registry.npmjs.org/zod/-/zod-4.1.13.tgz","integrity": "sha512-AvvthqfqrAhNH9dnfmrfKzX5upOdjUVJYFqNSlkmGf64gRaTzlPwz99IHYnVs28qYAybvAlBV+H7pn0saFY4Ig==","license": "MIT",- "peer": true,"funding": {"url": "https://github.com/sponsors/colinhacks"}@@ -18661,7 +18650,6 @@"resolved": "https://registry.npmjs.org/@octokit/core/-/core-5.2.1.tgz","integrity": "sha512-dKYCMuPO1bmrpuogcjQ8z7ICCH3FP6WmxpwC03yjzGfZhj9fTJg6+bS1+UAplekbN2C+M61UNllGOOoAfGCrdQ==","license": "MIT",- "peer": true,"dependencies": {"@octokit/auth-token": "^4.0.0","@octokit/graphql": "^7.1.0",@@ -19105,7 +19093,6 @@"version": "1.9.0","resolved": "https://registry.npmjs.org/@opentelemetry/api/-/api-1.9.0.tgz","integrity": "sha512-3giAOQvZiH5F9bMlMiv8+GSPMeqg0dbaeo58/0SlA9sxSqZhnUtxzX9/2FzyhS9sWQf5S0GJE0AKBrFqjpeYcg==",- "peer": true,"engines": {"node": ">=8.0.0"}@@ -19769,7 +19756,6 @@"resolved": "https://registry.npmjs.org/@react-email/body/-/body-0.2.0.tgz","integrity": "sha512-9GCWmVmKUAoRfloboCd+RKm6X17xn7eGL7HnpAZUnjBXBilWCxsKnLMTC/ixSHDKS/A/057M1Tx6ZUXd89sVBw==","license": "MIT",- "peer": true,"peerDependencies": {"react": "^18.0 || ^19.0 || ^19.0.0-rc"}@@ -19779,7 +19765,6 @@"resolved": "https://registry.npmjs.org/@react-email/button/-/button-0.2.0.tgz","integrity": "sha512-8i+v6cMxr2emz4ihCrRiYJPp2/sdYsNNsBzXStlcA+/B9Umpm5Jj3WJKYpgTPM+aeyiqlG/MMI1AucnBm4f1oQ==","license": "MIT",- "peer": true,"engines": {"node": ">=18.0.0"},@@ -19792,7 +19777,6 @@"resolved": "https://registry.npmjs.org/@react-email/code-block/-/code-block-0.2.0.tgz","integrity": "sha512-eIrPW9PIFgDopQU0e/OPpwCW2QWQDtNZDSsiN4sJO8KdMnWWnXJicnRfzrit5rHwFo+Y98i+w/Y5ScnBAFr1dQ==","license": "MIT",- "peer": true,"dependencies": {"prismjs": "^1.30.0"},@@ -19808,7 +19792,6 @@"resolved": "https://registry.npmjs.org/@react-email/code-inline/-/code-inline-0.0.5.tgz","integrity": "sha512-MmAsOzdJpzsnY2cZoPHFPk6uDO/Ncpb4Kh1hAt9UZc1xOW3fIzpe1Pi9y9p6wwUmpaeeDalJxAxH6/fnTquinA==","license": "MIT",- "peer": true,"engines": {"node": ">=18.0.0"},@@ -19884,7 +19867,6 @@"resolved": "https://registry.npmjs.org/@react-email/container/-/container-0.0.15.tgz","integrity": "sha512-Qo2IQo0ru2kZq47REmHW3iXjAQaKu4tpeq/M8m1zHIVwKduL2vYOBQWbC2oDnMtWPmkBjej6XxgtZByxM6cCFg==","license": "MIT",- "peer": true,"engines": {"node": ">=18.0.0"},@@ -19918,7 +19900,6 @@"resolved": "https://registry.npmjs.org/@react-email/heading/-/heading-0.0.15.tgz","integrity": "sha512-xF2GqsvBrp/HbRHWEfOgSfRFX+Q8I5KBEIG5+Lv3Vb2R/NYr0s8A5JhHHGf2pWBMJdbP4B2WHgj/VUrhy8dkIg==","license": "MIT",- "peer": true,"engines": {"node": ">=18.0.0"},@@ -19931,7 +19912,6 @@"resolved": "https://registry.npmjs.org/@react-email/hr/-/hr-0.0.11.tgz","integrity": "sha512-S1gZHVhwOsd1Iad5IFhpfICwNPMGPJidG/Uysy1AwmspyoAP5a4Iw3OWEpINFdgh9MHladbxcLKO2AJO+cA9Lw==","license": "MIT",- "peer": true,"engines": {"node": ">=18.0.0"},@@ -19956,7 +19936,6 @@"resolved": "https://registry.npmjs.org/@react-email/img/-/img-0.0.11.tgz","integrity": "sha512-aGc8Y6U5C3igoMaqAJKsCpkbm1XjguQ09Acd+YcTKwjnC2+0w3yGUJkjWB2vTx4tN8dCqQCXO8FmdJpMfOA9EQ==","license": "MIT",- "peer": true,"engines": {"node": ">=18.0.0"},@@ -19969,7 +19948,6 @@"resolved": "https://registry.npmjs.org/@react-email/link/-/link-0.0.12.tgz","integrity": "sha512-vF+xxQk2fGS1CN7UPQDbzvcBGfffr+GjTPNiWM38fhBfsLv6A/YUfaqxWlmL7zLzVmo0K2cvvV9wxlSyNba1aQ==","license": "MIT",- "peer": true,"engines": {"node": ">=18.0.0"},@@ -19997,7 +19975,6 @@"resolved": "https://registry.npmjs.org/@react-email/preview/-/preview-0.0.13.tgz","integrity": "sha512-F7j9FJ0JN/A4d7yr+aw28p4uX7VLWs7hTHtLo7WRyw4G+Lit6Zucq4UWKRxJC8lpsUdzVmG7aBJnKOT+urqs/w==","license": "MIT",- "peer": true,"engines": {"node": ">=18.0.0"},@@ -20102,7 +20079,6 @@"resolved": "https://registry.npmjs.org/@react-email/text/-/text-0.1.5.tgz","integrity": "sha512-o5PNHFSE085VMXayxH+SJ1LSOtGsTv+RpNKnTiJDrJUwoBu77G3PlKOsZZQHCNyD28WsQpl9v2WcJLbQudqwPg==","license": "MIT",- "peer": true,"engines": {"node": ">=18.0.0"},@@ -22244,7 +22220,6 @@"resolved": "https://registry.npmjs.org/@types/node/-/node-20.19.23.tgz","integrity": "sha512-yIdlVVVHXpmqRhtyovZAcSy0MiPcYWGkoO4CGe/+jpP0hmNuihm4XhHbADpK++MsiLHP5MVlv+bcgdF99kSiFQ==","license": "MIT",- "peer": true,"dependencies": {"undici-types": "~6.21.0"}@@ -22735,7 +22710,6 @@"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.20.0.tgz","integrity": "sha512-bYerPDF/H5v6V76MdMYhjwmwgMA+jlPVqjSDq2cRqMi8bP5sR3Z+RLOiOMad3nsnmDVmn2gAFCyNgh/dIrfP/w==","dev": true,- "peer": true,"dependencies": {"@typescript-eslint/scope-manager": "6.20.0","@typescript-eslint/types": "6.20.0",@@ -23194,7 +23168,6 @@"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz","integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==","license": "MIT",- "peer": true,"bin": {"acorn": "bin/acorn"},@@ -23683,7 +23656,6 @@"resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-5.4.1.tgz","integrity": "sha512-+I//4cYPccV8LdmBLiX8CYvf9Sp3vQsrqu2QNXRcrbiWvcx/UdlFiqUJJzxRQxgsZmvhXhn4cSKeSmoFjVdupA==","license": "MIT",- "peer": true,"dependencies": {"bn.js": "^4.0.0","inherits": "^2.0.1",@@ -23813,7 +23785,6 @@"resolved": "https://registry.npmjs.org/axios/-/axios-1.12.2.tgz","integrity": "sha512-vMJzPewAlRyOgxV2dU0Cuz2O8zzzx9VYtbJOaBgXFeLc4IV/Eg50n4LowmehOOR61S8ZMpc2K5Sa7g6A4jfkUw==","license": "MIT",- "peer": true,"dependencies": {"follow-redirects": "^1.15.6","form-data": "^4.0.4",@@ -24413,7 +24384,6 @@}],"license": "MIT",- "peer": true,"dependencies": {"baseline-browser-mapping": "^2.8.9","caniuse-lite": "^1.0.30001746",@@ -25843,7 +25813,6 @@"version": "16.4.1","resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.4.1.tgz","integrity": "sha512-CjA3y+Dr3FyFDOAMnxZEGtnW9KBR2M0JvvUtXNW+dYJL5ROWxP9DUHCwgFqpMk0OXCc0ljhaNTr2w/kutYIcHQ==",- "peer": true,"engines": {"node": ">=12"},@@ -26230,7 +26199,6 @@"dev": true,"hasInstallScript": true,"license": "MIT",- "peer": true,"bin": {"esbuild": "bin/esbuild"},@@ -26313,7 +26281,6 @@"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.56.0.tgz","integrity": "sha512-Go19xM6T9puCOWntie1/P997aXxFsOi37JIHRWI514Hc6ZnaHGKY9xFhrU65RT6CcBEzZoGG1e6Nq+DT04ZtZQ==","dev": true,- "peer": true,"dependencies": {"@eslint-community/eslint-utils": "^4.2.0","@eslint-community/regexpp": "^4.6.1",@@ -26412,7 +26379,6 @@"resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-9.1.0.tgz","integrity": "sha512-NSWl5BFQWEPi1j4TjVNItzYV7dZXZ+wP6I6ZhrBGpChQhZRUaElihE9uRRkcbRnNb76UMKDF3r+WTmNcGPKsqw==","dev": true,- "peer": true,"bin": {"eslint-config-prettier": "bin/cli.js"},@@ -26501,7 +26467,6 @@"resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.29.1.tgz","integrity": "sha512-BbPC0cuExzhiMo4Ff1BTVwHpjjv28C5R+btTOGaCRC7UEz801up0JadwkeSk5Ued6TG34uaczuVuH6qyy5YUxw==","dev": true,- "peer": true,"dependencies": {"array-includes": "^3.1.7","array.prototype.findlastindex": "^1.2.3",@@ -26913,7 +26878,6 @@"resolved": "https://registry.npmjs.org/express/-/express-4.21.2.tgz","integrity": "sha512-28HqgMZAmih1Czt9ny7qr6ek2qddF4FclbMzwhCREB6OFfH+rXAnuNCwo1/wFvrtbgsQDb4kSbX9de9lFbrXnA==","license": "MIT",- "peer": true,"dependencies": {"accepts": "~1.3.8","array-flatten": "1.1.1",@@ -26975,6 +26939,7 @@"resolved": "https://registry.npmjs.org/express-session/-/express-session-1.18.1.tgz","integrity": "sha512-a5mtTqEaZvBCL9A9aqkrtfz+3SMDhOVUnjafjo+s7A9Txkq+SVX2DLvSp1Zrv4uCXa3lMSK3viWnh9Gg07PBUA==","license": "MIT",+ "peer": true,"dependencies": {"cookie": "0.7.2","cookie-signature": "1.0.7",@@ -26992,12 +26957,14 @@"node_modules/express-session/node_modules/cookie-signature": {"version": "1.0.7","resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.7.tgz",- "integrity": "sha512-NXdYc3dLr47pBkpUCHtKSwIOQXLVn8dZEuywboCOJY/osA0wFSLlSawr3KN8qXJEyX66FcONTH8EIlVuK0yyFA=="+ "integrity": "sha512-NXdYc3dLr47pBkpUCHtKSwIOQXLVn8dZEuywboCOJY/osA0wFSLlSawr3KN8qXJEyX66FcONTH8EIlVuK0yyFA==",+ "peer": true},"node_modules/express-session/node_modules/debug": {"version": "2.6.9","resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz","integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",+ "peer": true,"dependencies": {"ms": "2.0.0"}@@ -27005,7 +26972,8 @@"node_modules/express-session/node_modules/ms": {"version": "2.0.0","resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",- "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A=="+ "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==",+ "peer": true},"node_modules/express/node_modules/cookie": {"version": "0.7.1",@@ -31821,6 +31789,7 @@"version": "1.0.2","resolved": "https://registry.npmjs.org/on-headers/-/on-headers-1.0.2.tgz","integrity": "sha512-pZAE+FJLoyITytdqK0U5s+FIpjN0JP3OzFi/u8Rx+EV5/W+JTWGXG8xFzevE7AjBfDqHv/8vL8qQsIhHnqRkrA==",+ "peer": true,"engines": {"node": ">= 0.8"}@@ -32409,19 +32378,6 @@}}},- "node_modules/pg-boss": {- "version": "10.1.5",- "resolved": "https://registry.npmjs.org/pg-boss/-/pg-boss-10.1.5.tgz",- "integrity": "sha512-H87NL6c7N6nTCSCePh16EaSQVSFevNXWdJuzY6PZz4rw+W/nuMKPfI/vYyXS0AdT1g1Q3S3EgeOYOHcB7ZVToQ==",- "dependencies": {- "cron-parser": "^4.9.0",- "pg": "^8.13.0",- "serialize-error": "^8.1.0"- },- "engines": {- "node": ">=20"- }- },"node_modules/pg-cloudflare": {"version": "1.1.1","resolved": "https://registry.npmjs.org/pg-cloudflare/-/pg-cloudflare-1.1.1.tgz",@@ -32522,7 +32478,6 @@"version": "3.0.1","resolved": "https://registry.npmjs.org/picomatch/-/picomatch-3.0.1.tgz","integrity": "sha512-I3EurrIQMlRc9IaAZnqRR044Phh2DXY+55o7uJ0V+hYZAcQYSuFWsc9q5PvyDHUSCe1Qxn/iBz+78s86zWnGag==",- "peer": true,"engines": {"node": ">=10"},@@ -32865,7 +32820,6 @@}],"license": "MIT",- "peer": true,"dependencies": {"nanoid": "^3.3.11","picocolors": "^1.1.1",@@ -32963,7 +32917,6 @@"resolved": "https://registry.npmjs.org/prettier/-/prettier-3.5.3.tgz","integrity": "sha512-QQtaxnoDJeAkDvDKWCLiwIXkTgRhwYDEQCghU9Z6q03iyek/rxRh/2lC3HB7P8sWT2xC/y5JDctPLBIGzHKbhw==","license": "MIT",- "peer": true,"bin": {"prettier": "bin/prettier.cjs"},@@ -33389,6 +33342,7 @@"version": "1.0.0","resolved": "https://registry.npmjs.org/random-bytes/-/random-bytes-1.0.0.tgz","integrity": "sha512-iv7LhNVO047HzYR3InF6pUcUsPQiHTM1Qal51DcGSuZFBil1aBBWG5eHPNek7bvILMaYJ/8RU1e8w1AMdHmLQQ==",+ "peer": true,"engines": {"node": ">= 0.8"}@@ -33460,7 +33414,6 @@"resolved": "https://registry.npmjs.org/react/-/react-19.1.0.tgz","integrity": "sha512-FS+XFBNvn3GTAWq26joslQgWNoFu08F4kl0J4CgdNKADkdSGXQyTCnKteIAJy96Br6YbpEU1LSzV5dYtjMkMDg==","license": "MIT",- "peer": true,"engines": {"node": ">=0.10.0"}@@ -33470,7 +33423,6 @@"resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.1.0.tgz","integrity": "sha512-Xs1hdnE+DyKgeHJeJznQmYMIBG3TKIHJJT95Q58nHLSrElKlGQqDTR2HQ9fx5CN/Gk6Vh/kupBTDLU11/nDk/g==","license": "MIT",- "peer": true,"dependencies": {"scheduler": "^0.26.0"},@@ -34548,20 +34500,6 @@"resolved": "https://registry.npmjs.org/seq-queue/-/seq-queue-0.0.5.tgz","integrity": "sha512-hr3Wtp/GZIc/6DAGPDcV4/9WoZhjrkXsi5B/07QgX8tsdc6ilr7BFM6PM6rbdAX1kFSDYeZGLipIZZKyQP0O5Q=="},- "node_modules/serialize-error": {- "version": "8.1.0",- "resolved": "https://registry.npmjs.org/serialize-error/-/serialize-error-8.1.0.tgz",- "integrity": "sha512-3NnuWfM6vBYoy5gZFvHiYsVbafvI9vZv/+jlIigFn4oP4zjNPK3LhcY0xSCgeb1a5L8jO71Mit9LlNoi2UfDDQ==",- "dependencies": {- "type-fest": "^0.20.2"- },- "engines": {- "node": ">=10"- },- "funding": {- "url": "https://github.com/sponsors/sindresorhus"- }- },"node_modules/serve-static": {"version": "1.16.2","resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.16.2.tgz",@@ -36247,7 +36185,6 @@"resolved": "https://registry.npmjs.org/socks/-/socks-2.8.4.tgz","integrity": "sha512-D3YaD0aRxR3mEcqnidIs7ReYJFVzWdd6fXJYUM8ixcQcJRGTka/b3saV0KflYhyVJXKhb947GndU35SxYNResQ==","license": "MIT",- "peer": true,"dependencies": {"ip-address": "^9.0.5","smart-buffer": "^4.2.0"@@ -37551,7 +37488,6 @@"integrity": "sha512-ytQKuwgmrrkDTFP4LjR0ToE2nqgy886GpvRSpU0JAnrdBYppuY5rLkRUYPU1yCryb24SsKBTL/hlDQAEFVwtZg==","dev": true,"license": "MIT",- "peer": true,"dependencies": {"esbuild": "~0.25.0","get-tsconfig": "^4.7.5"@@ -37629,6 +37565,7 @@"version": "0.20.2","resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz","integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==",+ "dev": true,"engines": {"node": ">=10"},@@ -37719,7 +37656,6 @@"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.2.tgz","integrity": "sha512-6l+RyNy7oAHDfxC4FzSJcz9vnjTKxrLpDG5M2Vu4SHRVNg6xzqZp6LYSR9zjqQTu8DU/f5xwxUdADOkbrIX2gQ==","dev": true,- "peer": true,"bin": {"tsc": "bin/tsc","tsserver": "bin/tsserver"@@ -37760,6 +37696,7 @@"version": "2.1.5","resolved": "https://registry.npmjs.org/uid-safe/-/uid-safe-2.1.5.tgz","integrity": "sha512-KPHm4VL5dDXKz01UuEd88Df+KzynaohSL9fBh096KWAxSKZQDI2uBrVqtvRM4rwrIrRRKsdLNML/lnaaVSRioA==",+ "peer": true,"dependencies": {"random-bytes": "~1.0.0"},@@ -38318,7 +38255,6 @@"integrity": "sha512-ZWyE8YXEXqJrrSLvYgrRP7p62OziLW7xI5HYGWFzOvupfAlrLvURSzv/FyGyy0eidogEM3ujU+kUG1zuHgb6Ug==","dev": true,"license": "MIT",- "peer": true,"dependencies": {"esbuild": "^0.25.0","fdir": "^6.5.0",@@ -38972,7 +38908,6 @@"resolved": "https://registry.npmjs.org/zod/-/zod-3.24.3.tgz","integrity": "sha512-HhY1oqzWCQWuUqvBFnsyrtZRhyPeR7SUGv+C4+MsisMuVfSPx8HpwWqH8tRahSlt6M3PiFAcoeFhZAqIXTxoSg==","license": "MIT",- "peer": true,"funding": {"url": "https://github.com/sponsors/colinhacks"}diff --git a/backend/package.json b/backend/package.jsonindex 310b5cbdb8..a370701dea 100644--- a/backend/package.json+++ b/backend/package.json@@ -243,7 +243,6 @@"passport-ldapauth": "^3.0.1","passport-oauth2": "^1.8.0","pg": "^8.11.3",- "pg-boss": "^10.1.5","pg-query-stream": "^4.5.3","pg-types": "^2.2.0","picomatch": "^3.0.1",diff --git a/backend/src/@types/knex.d.ts b/backend/src/@types/knex.d.tsindex 089367103a..ec9293c1e5 100644--- a/backend/src/@types/knex.d.ts+++ b/backend/src/@types/knex.d.ts@@ -416,9 +416,6 @@ import {TProjectTemplateUserMemberships,TProjectTemplateUserMembershipsInsert,TProjectTemplateUserMembershipsUpdate,- TQueueJobs,- TQueueJobsInsert,- TQueueJobsUpdate,TRateLimit,TRateLimitInsert,TRateLimitUpdate,@@ -1719,7 +1716,6 @@ declare module "knex/types/tables" {TOrganizationAssetsUpdate>;- [TableName.QueueJobs]: KnexOriginal.CompositeTableType<TQueueJobs, TQueueJobsInsert, TQueueJobsUpdate>;[TableName.AppConnectionCredentialRotation]: KnexOriginal.CompositeTableType<TAppConnectionCredentialRotations,TAppConnectionCredentialRotationsInsert,diff --git a/backend/src/db/migrations/20260203141935_durable-queue.ts b/backend/src/db/migrations/20260203141935_durable-queue.tsindex c70a9d1be5..8d8aa517f9 100644--- a/backend/src/db/migrations/20260203141935_durable-queue.ts+++ b/backend/src/db/migrations/20260203141935_durable-queue.ts@@ -3,9 +3,11 @@ import { Knex } from "knex";import { QueueJobs, QueueName } from "@app/queue";-import { TableName } from "../schemas";import { createOnUpdateTrigger, dropOnUpdateTrigger } from "../utils";+// Inlined because QueueJobsTable was removed when the queue_jobs table was dropped.+const QueueJobsTable = "queue_jobs";+interface MigrationConfig<TData> {pgBossQueueName: string;queueName: string;@@ -29,7 +31,7 @@ const migratePgBossJobsToQueueJobs = async <TData>(knex: Knex, config: Migration[config.pgBossQueueName]);if (jobs.rows.length > 0) {- await knex(TableName.QueueJobs).insert(+ await knex(QueueJobsTable).insert(jobs.rows.map((job) => {const { jobId, queueOptions } = config.transformJob(job);return {@@ -85,9 +87,9 @@ const migrateDynamicSecretRevocationToQueueJobs = async (knex: Knex) => {};export async function up(knex: Knex): Promise<void> {- const hasTable = await knex.schema.hasTable(TableName.QueueJobs);+ const hasTable = await knex.schema.hasTable(QueueJobsTable);if (!hasTable) {- await knex.schema.createTable(TableName.QueueJobs, (t) => {+ await knex.schema.createTable(QueueJobsTable, (t) => {t.uuid("id", { primaryKey: true }).defaultTo(knex.fn.uuid());t.string("queueName").notNullable();// helps in golang migration@@ -112,7 +114,7 @@ export async function up(knex: Knex): Promise<void> {t.index(["status"]);});- await createOnUpdateTrigger(knex, TableName.QueueJobs);+ await createOnUpdateTrigger(knex, QueueJobsTable);const schemaCheck = await knex.raw(`SELECT EXISTS (SELECT 1 FROM information_schema.schemata WHERE schema_name = 'pgboss') AS exists`);@@ -125,7 +127,7 @@ export async function up(knex: Knex): Promise<void> {}export async function down(knex: Knex): Promise<void> {- const hasTable = await knex.schema.hasTable(TableName.QueueJobs);- if (hasTable) await knex.schema.dropTable(TableName.QueueJobs);- await dropOnUpdateTrigger(knex, TableName.QueueJobs);+ const hasTable = await knex.schema.hasTable(QueueJobsTable);+ if (hasTable) await knex.schema.dropTable(QueueJobsTable);+ await dropOnUpdateTrigger(knex, QueueJobsTable);}diff --git a/backend/src/db/migrations/20260327210655_drop-queue-persistence.ts b/backend/src/db/migrations/20260327210655_drop-queue-persistence.tsnew file mode 100644index 0000000000..d929b04016--- /dev/null+++ b/backend/src/db/migrations/20260327210655_drop-queue-persistence.ts@@ -0,0 +1,43 @@+import { Knex } from "knex";++import { createOnUpdateTrigger, dropOnUpdateTrigger } from "../utils";++const QUEUE_JOBS_TABLE = "queue_jobs";++export async function up(knex: Knex): Promise<void> {+ const hasTable = await knex.schema.hasTable(QUEUE_JOBS_TABLE);+ if (hasTable) {+ await knex.schema.dropTable(QUEUE_JOBS_TABLE);+ await dropOnUpdateTrigger(knex, QUEUE_JOBS_TABLE);+ }+}++export async function down(knex: Knex): Promise<void> {+ const hasTable = await knex.schema.hasTable(QUEUE_JOBS_TABLE);+ if (!hasTable) {+ await knex.schema.createTable(QUEUE_JOBS_TABLE, (t) => {+ t.uuid("id", { primaryKey: true }).defaultTo(knex.fn.uuid());+ t.string("queueName").notNullable();+ t.string("queueType").notNullable().defaultTo("bullmq");+ t.string("queueJobName").notNullable();+ t.string("jobId").notNullable();+ t.jsonb("queueData").notNullable();+ t.jsonb("queueOptions");+ t.string("status").notNullable().defaultTo("pending");++ t.integer("attempts").notNullable().defaultTo(0);+ t.integer("maxAttempts").notNullable().defaultTo(3);+ t.string("errorMessage", 1000);+ t.datetime("lastHeartBeat");+ t.datetime("startedAt");+ t.datetime("completedAt");+ t.timestamps(true, true, true);++ t.index(["queueName", "status", "createdAt"]);+ t.index(["jobId", "queueName"]);+ t.index(["status"]);+ });++ await createOnUpdateTrigger(knex, QUEUE_JOBS_TABLE);+ }+}diff --git a/backend/src/db/schemas/index.ts b/backend/src/db/schemas/index.tsindex 54f2e123d0..67b77e88b5 100644--- a/backend/src/db/schemas/index.ts+++ b/backend/src/db/schemas/index.ts@@ -164,7 +164,6 @@ export * from "./project-templates";export * from "./project-user-additional-privilege";export * from "./project-user-membership-roles";export * from "./projects";-export * from "./queue-jobs";export * from "./rate-limit";export * from "./relays";export * from "./resource-metadata";diff --git a/backend/src/db/schemas/models.ts b/backend/src/db/schemas/models.tsindex 5daa1ff79b..a3041b74c3 100644--- a/backend/src/db/schemas/models.ts+++ b/backend/src/db/schemas/models.ts@@ -276,7 +276,6 @@ export enum TableName {PkiSigners = "pki_signers",PkiSigningOperations = "pki_signing_operations",- QueueJobs = "queue_jobs",CaSigningConfig = "ca_signing_configs",SecretValidationRule = "secret_validation_rules"}diff --git a/backend/src/db/schemas/queue-jobs.ts b/backend/src/db/schemas/queue-jobs.tsdeleted file mode 100644index 042d4f97b1..0000000000--- a/backend/src/db/schemas/queue-jobs.ts+++ /dev/null@@ -1,31 +0,0 @@-// Code generated by automation script, DO NOT EDIT.-// Automated by pulling database and generating zod schema-// To update. Just run npm run generate:schema-// Written by akhilmhdh.--import { z } from "zod";--import { TImmutableDBKeys } from "./models";--export const QueueJobsSchema = z.object({- id: z.string().uuid(),- queueName: z.string(),- queueType: z.string().default("bullmq"),- queueJobName: z.string(),- jobId: z.string(),- queueData: z.unknown(),- queueOptions: z.unknown().nullable().optional(),- status: z.string().default("pending"),- attempts: z.number().default(0),- maxAttempts: z.number().default(3),- errorMessage: z.string().nullable().optional(),- lastHeartBeat: z.date().nullable().optional(),- startedAt: z.date().nullable().optional(),- completedAt: z.date().nullable().optional(),- createdAt: z.date(),- updatedAt: z.date()-});--export type TQueueJobs = z.infer<typeof QueueJobsSchema>;-export type TQueueJobsInsert = Omit<z.input<typeof QueueJobsSchema>, TImmutableDBKeys>;-export type TQueueJobsUpdate = Partial<Omit<z.input<typeof QueueJobsSchema>, TImmutableDBKeys>>;diff --git a/backend/src/ee/services/dynamic-secret-lease/dynamic-secret-lease-queue.ts b/backend/src/ee/services/dynamic-secret-lease/dynamic-secret-lease-queue.tsindex fee084831b..688db03690 100644--- a/backend/src/ee/services/dynamic-secret-lease/dynamic-secret-lease-queue.ts+++ b/backend/src/ee/services/dynamic-secret-lease/dynamic-secret-lease-queue.ts@@ -94,7 +94,7 @@ export const dynamicSecretLeaseQueueServiceFactory = ({const queueFailedRevocation = async (leaseId: string, dynamicSecretId: string) => {const appConfig = getConfig();- const retryDelaySeconds = appConfig.isDevelopmentMode ? 1 : Math.floor(applyJitter(3_600_000 * 4) / 1000); // retry every 4 hours with 20% +- jitter (convert ms to seconds for pgboss)+ const retryDelaySeconds = appConfig.isDevelopmentMode ? 1 : Math.floor(applyJitter(3_600_000 * 4) / 1000); // retry every 4 hours with 20% +- jitterawait queueService.queue(QueueName.DynamicSecretRevocation,@@ -259,7 +259,7 @@ export const dynamicSecretLeaseQueueServiceFactory = ({// if all retries fail, we should also stop the automatic revocation job.// the ID of the revocation job is set to the leaseId, so we can use that to stop the job- // we dont have to stop the retry job, because if we hit this point, its the last attempt and the retry job will be stopped by pgboss itself after this point,+ // we dont have to stop the retry job, because if we hit this point, its the last attempt and BullMQ will stop it after this pointawait queueService.stopJobById(QueueName.DynamicSecretRevocation, leaseId);await $queueDynamicSecretLeaseRevocationFailedEmail(leaseId, dynamicSecretId);@@ -330,19 +330,10 @@ export const dynamicSecretLeaseQueueServiceFactory = ({}};- queueService.start(- QueueName.DynamicSecretRevocation,- async (job) => {- await $dynamicSecretQueueJob(job.name, job.id as string, job.data, job.attemptsMade + 1);- },- {- persistence: true- }- );+ queueService.start(QueueName.DynamicSecretRevocation, async (job) => {+ await $dynamicSecretQueueJob(job.name, job.id as string, job.data, job.attemptsMade + 1);+ });- // we use redis for sending the email because:- // 1. we are insensitive to losing the jobs in queue in case of a disaster event- // 2. pgboss does not support exclusive job keys on v0.10.x, and upgrading to v0.11.x which supports exclusive jobs comes with a lot of breaking changes, and we would need to manually migrate our existing jobs to the new versionqueueService.start(QueueName.DynamicSecretLeaseRevocationFailedEmail, async (job) => {await $dynamicSecretLeaseRevocationFailedEmailJob(job.id as string, job.data);});diff --git a/backend/src/ee/services/pki-acme/pki-acme-queue.ts b/backend/src/ee/services/pki-acme/pki-acme-queue.tsindex d7f739ca24..4f3cbef634 100644--- a/backend/src/ee/services/pki-acme/pki-acme-queue.ts+++ b/backend/src/ee/services/pki-acme/pki-acme-queue.ts@@ -31,7 +31,7 @@ export const pkiAcmeQueueServiceFactory = async ({error,`Failed to validate ACME challenge ${challengeId} (retryCount ${retryCount}): ${errorMessage}`);- // Re-throw to let pg-boss handle retries with exponential backoff+ // Re-throw to let BullMQ handle retries with exponential backoffthrow error;}});diff --git a/backend/src/ee/services/pki-acme/pki-acme-service.ts b/backend/src/ee/services/pki-acme/pki-acme-service.tsindex 60d57fed97..3e261efc8d 100644--- a/backend/src/ee/services/pki-acme/pki-acme-service.ts+++ b/backend/src/ee/services/pki-acme/pki-acme-service.ts@@ -1289,8 +1289,7 @@ export const pkiAcmeServiceFactory = ({throw error;}if (certIssuanceJobData) {- // TODO: ideally, this should be done inside the transaction, but the pg-boss queue doesn't support external transactions- // as it seems to be. we need to commit the transaction before queuing the job, otherwise the job will fail (not found error).+ // We commit the transaction before queuing the job, otherwise the job may fail with a not-found error.await certificateIssuanceQueue.queueCertificateIssuance(certIssuanceJobData);}order = updatedOrder;diff --git a/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-queue.ts b/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-queue.tsindex 2f8b6450bc..2eaec1c3db 100644--- a/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-queue.ts+++ b/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-queue.ts@@ -48,24 +48,18 @@ export const secretRotationV2QueueServiceFactory = async ({logger.warn("Secret Rotation V2 is in development mode.");}- queueService.start(- QueueName.SecretRotationV2RotateSecrets,- async (job) => {- await rotateSecretsFns({- job: {- id: job.id || job.data?.rotationId,- retryCount: job.attemptsMade + 1,- retryLimit: job.opts.attempts || 1,- data: job.data- },- secretRotationV2DAL,- secretRotationV2Service- });- },- {- persistence: true- }- );+ queueService.start(QueueName.SecretRotationV2RotateSecrets, async (job) => {+ await rotateSecretsFns({+ job: {+ id: job.id || job.data?.rotationId,+ retryCount: job.attemptsMade + 1,+ retryLimit: job.opts.attempts || 1,+ data: job.data+ },+ secretRotationV2DAL,+ secretRotationV2Service+ });+ });queueService.start(QueueName.SecretRotationV2, async (job) => {if (job.name === QueueJobs.SecretRotationV2QueueRotations) {diff --git a/backend/src/main.ts b/backend/src/main.tsindex 2b29db5f74..cef7a188a2 100644--- a/backend/src/main.ts+++ b/backend/src/main.ts@@ -20,7 +20,6 @@ import { removeTemporaryBaseDirectory } from "./lib/files";import { initLogger } from "./lib/logger";import { CustomLogger } from "./lib/logger/logger";import { queueServiceFactory } from "./queue";-import { queueJobsDALFactory } from "./queue/queue-jobs-dal";import { main } from "./server/app";import { bootstrapCheck } from "./server/boot-strap-check";import { kmsRootConfigDALFactory } from "./services/kms/kms-root-config-dal";@@ -83,8 +82,7 @@ const run = async () => {const smtp = smtpServiceFactory(formatSmtpConfig());- const queueJobsDAL = queueJobsDALFactory(db);- const queue = queueServiceFactory(envConfig, queueJobsDAL);+ const queue = queueServiceFactory(envConfig);const keyValueStoreDAL = keyValueStoreDALFactory(db);const keyStore = keyStoreFactory(envConfig, keyValueStoreDAL);@@ -105,7 +103,6 @@ const run = async () => {envConfig});- await queue.initialize();const bootstrap = await bootstrapCheck({ db });// eslint-disable-next-linediff --git a/backend/src/queue/queue-jobs-dal.ts b/backend/src/queue/queue-jobs-dal.tsdeleted file mode 100644index 7bb3d7b722..0000000000--- a/backend/src/queue/queue-jobs-dal.ts+++ /dev/null@@ -1,88 +0,0 @@-import { TDbClient } from "@app/db";-import { TableName, TQueueJobs } from "@app/db/schemas";-import { ormify } from "@app/lib/knex";-import { logger } from "@app/lib/logger";-import { QueueName } from "@app/queue";--import { PersistenceQueueStatus } from "./queue-types";--const QUEUE_JOBS_PRUNE_BATCH_SIZE = 10000;-const MAX_RETRY_ON_FAILURE = 3;--export type TQueueJobsDALFactory = ReturnType<typeof queueJobsDALFactory>;--export const queueJobsDALFactory = (db: TDbClient) => {- const orm = ormify(db, TableName.QueueJobs);-- /**- * Find stuck processing jobs for a specific queue using COALESCE(lastHeartBeat, updatedAt)- * A job is considered stuck if the time since last heartbeat (or update) exceeds the threshold- */- const findStuckJobsByQueue = async (queueName: string, thresholdMs: number): Promise<TQueueJobs[]> => {- const result = await db<TQueueJobs>(TableName.QueueJobs)- .select("*")- .where("status", PersistenceQueueStatus.Processing)- .where("queueName", queueName)- .whereRaw(`(NOW() - COALESCE("lastHeartBeat", "updatedAt")) > INTERVAL '1 millisecond' * ?`, [thresholdMs]);-- return result as TQueueJobs[];- };-- const updateJobFailure = async (queueName: string, jobId: string, error: string) => {- const job = await db(TableName.QueueJobs)- .where("jobId", jobId)- .where("queueName", queueName)- .update({- attempts: db.raw("attempts + 1") as unknown as number,- errorMessage: error.slice(0, 1000),- status: db.raw(- `- CASE- WHEN "attempts" + 1 >= "maxAttempts" THEN ?- ELSE ?- END- `,- [PersistenceQueueStatus.Dead, PersistenceQueueStatus.Failed]- ) as unknown as string- });- return job;- };-- // delete all queue jobs that are dead or completed- const pruneQueueJobs = async () => {- let deletedJobIds: { id: string }[] = [];- let numberOfRetryOnFailure = 0;- let isRetrying = false;-- logger.info(`${QueueName.DailyResourceCleanUp}: queue jobs cleanup started`);- do {- try {- const findCompletedOrDeadJobsSubQuery = db(TableName.QueueJobs)- .whereIn("status", [PersistenceQueueStatus.Completed, PersistenceQueueStatus.Dead])- .select("id")- .limit(QUEUE_JOBS_PRUNE_BATCH_SIZE);-- // eslint-disable-next-line no-await-in-loop- deletedJobIds = await db(TableName.QueueJobs)- .whereIn("id", findCompletedOrDeadJobsSubQuery)- .del()- .returning("id");-- numberOfRetryOnFailure = 0; // reset- } catch (error) {- numberOfRetryOnFailure += 1;- deletedJobIds = [];- logger.error(error, "Failed to delete queue jobs on pruning");- } finally {- // eslint-disable-next-line no-await-in-loop- await new Promise((resolve) => {- setTimeout(resolve, 10); // time to breathe for db- });- }- isRetrying = numberOfRetryOnFailure > 0;- } while (deletedJobIds.length > 0 || (isRetrying && numberOfRetryOnFailure < MAX_RETRY_ON_FAILURE));- logger.info(`${QueueName.DailyResourceCleanUp}: queue jobs cleanup completed`);- };-- return { ...orm, findStuckJobsByQueue, updateJobFailure, pruneQueueJobs };-};diff --git a/backend/src/queue/queue-service.ts b/backend/src/queue/queue-service.tsindex d6b71cd339..b265f6fd41 100644--- a/backend/src/queue/queue-service.ts+++ b/backend/src/queue/queue-service.ts@@ -1,6 +1,6 @@import { Job, JobSchedulerJson, Queue, QueueOptions, RepeatOptions, Worker, WorkerListener } from "bullmq";-import { SecretEncryptionAlgo, SecretKeyEncoding, TQueueJobs } from "@app/db/schemas";+import { SecretEncryptionAlgo, SecretKeyEncoding } from "@app/db/schemas";import { TCreateAuditLogDTO } from "@app/ee/services/audit-log/audit-log-types";import { PamDiscoverySourceRunTrigger } from "@app/ee/services/pam-discovery/pam-discovery-enums";import {@@ -48,21 +48,12 @@ import {import { CacheType } from "@app/services/super-admin/super-admin-types";import { TWebhookPayloads } from "@app/services/webhook/webhook-types";-import { TQueueJobsDALFactory } from "./queue-jobs-dal";-import { PersistenceQueueStatus } from "./queue-types";--const RECOVERY_BATCH_SIZE = 500;-// Scheduler IDs are prefixed so they never collide with legacy repeatable-job// iteration IDs that may still be pending in Redis after the migration.// Bump the version if a future migration needs the same trick.export const JOB_SCHEDULER_PREFIX = "jsv1";export enum QueueName {- // Internal queues for durable queue recovery- QueueInternalRecovery = "queue-internal-recovery",- QueueInternalReconciliation = "queue-internal-reconciliation",-SecretRotation = "secret-rotation",SecretReminder = "secret-reminder",AuditLog = "audit-log",@@ -117,10 +108,6 @@ export enum QueueName {}export enum QueueJobs {- // Internal queue jobs for durable queue recovery- QueueRecovery = "queue-recovery-job",- QueueReconciliation = "queue-reconciliation-job",-SecretReminder = "secret-reminder-job",SecretRotation = "secret-rotation-job",AuditLog = "audit-log-job",@@ -212,22 +199,7 @@ export type TQueueOptions = {};};-export type TPersistenceConfig = {- enabled: boolean;- stuckThresholdMs?: number; // Default: 5 minutes (300000ms)-};-export type TQueueJobTypes = {- // Internal queue types for durable queue recovery- [QueueName.QueueInternalRecovery]: {- name: QueueJobs.QueueRecovery;- payload: undefined;- };- [QueueName.QueueInternalReconciliation]: {- name: QueueJobs.QueueReconciliation;- payload: undefined;- };-[QueueName.SecretReminder]: {payload: {projectId: string;@@ -598,18 +570,10 @@ const isQueueEnabled = (name: QueueName) => {};export type TQueueServiceFactory = {- initialize: () => Promise<void>;start: <T extends QueueName>(name: T,jobFn: (job: Job<TQueueJobTypes[T]["payload"], void, TQueueJobTypes[T]["name"]>, token?: string) => Promise<void>,- queueSettings?: Omit<QueueOptions, "connection"> & {- /*- Enable postgres backup persistance mechanism for schedule job- Avoid this for cron job and very high throughput job- Use updateJobHeartbeat() for long running job- */- persistence?: boolean | TPersistenceConfig;- }+ queueSettings?: Omit<QueueOptions, "connection">) => void;listen: <T extends QueueName,@@ -650,7 +614,6 @@ export type TQueueServiceFactory = {startOffset?: number,endOffset?: number) => Promise<{ delay: number; timestamp: number; repeatJobKey?: string; data?: unknown }[]>;- updateJobHeartbeat: <T extends QueueName>(queueName: T, jobId: string) => Promise<void>;upsertJobScheduler: <T extends QueueName>(name: T,schedulerId: string,@@ -669,10 +632,7 @@ export type TQueueServiceFactory = {getJobSchedulers: (name: QueueName, start?: number, end?: number) => Promise<JobSchedulerJson[]>;};-export const queueServiceFactory = (- redisCfg: TRedisConfigKeys,- queueJobsDAL: TQueueJobsDALFactory-): TQueueServiceFactory => {+export const queueServiceFactory = (redisCfg: TRedisConfigKeys): TQueueServiceFactory => {const isClusterMode = Boolean(redisCfg?.REDIS_CLUSTER_HOSTS);const connection = buildRedisFromConfig(redisCfg);const queueContainer: Partial<Record<QueueName, Queue<TQueueJobTypes[QueueName]["payload"], void, string>>> = {};@@ -681,311 +641,6 @@ export const queueServiceFactory = (Record<QueueName, Worker<TQueueJobTypes[QueueName]["payload"], void, TQueueJobTypes[QueueName]["name"]>>> = {};- const persistantQueues = new Set<QueueName>();-- // Configuration for persistent queues (threshold and max attempts)- const persistentQueueConfigs = new Map<- QueueName,- {- stuckThresholdMs: number;- }- >();-- /**- * Wraps a job function with heartbeat support for persistent queues.- * The heartbeat runs every 1 minute to signal the job is still alive.- */- const wrapJobWithHeartbeat = <T extends QueueName>(- name: T,- jobFn: (job: Job<TQueueJobTypes[T]["payload"], void, TQueueJobTypes[T]["name"]>, token?: string) => Promise<void>- ) => {- return async (job: Job<TQueueJobTypes[T]["payload"], void, TQueueJobTypes[T]["name"]>, token?: string) => {- let heartbeatInterval: ReturnType<typeof setInterval> | undefined;-- try {- // Start heartbeat interval (every 1 minute)- if (job.id) {- heartbeatInterval = setInterval(() => {- void queueJobsDAL.update({ jobId: job.id, queueName: name }, { lastHeartBeat: new Date() }).catch((err) => {- logger.error(err, "Failed to update job heartbeat");- });- }, 60 * 1000);- }-- await jobFn(job, token);- } finally {- if (heartbeatInterval) {- clearInterval(heartbeatInterval);- }- }- };- };-- /**- * Startup Recovery Function- * Recovers pending and failed jobs from PostgreSQL after server restart- * - Pending jobs: Jobs that were queued but not yet processed- * - Failed jobs: Jobs that failed but haven't reached max attempts (can retry)- * Uses pagination to avoid loading all jobs into memory at once- */- const startupRecovery = async () => {- logger.info("Starting queue startup recovery...");-- const queueNames = Array.from(persistantQueues);- if (queueNames.length === 0) {- logger.info("No persistent queues configured, skipping startup recovery");- return;- }-- try {- let offset = 0;- let totalRecovered = 0;- let jobsInBatch: TQueueJobs[];-- do {- // eslint-disable-next-line no-await-in-loop- jobsInBatch = await queueJobsDAL.find(- {- $in: {- queueName: queueNames,- status: [PersistenceQueueStatus.Pending, PersistenceQueueStatus.Failed]- }- },- {- limit: RECOVERY_BATCH_SIZE,- offset,- sort: [["createdAt", "asc"]]- }- );-- if (jobsInBatch.length > 0) {- logger.info({ batchSize: jobsInBatch.length, offset }, "Processing recovery batch");-- // eslint-disable-next-line no-await-in-loop- for (const job of jobsInBatch) {- const queueName = job.queueName as QueueName;- const q = queueContainer[queueName];- if (!q) {- logger.warn({ queueName, jobId: job.jobId }, "Queue not initialized, skipping job");- // eslint-disable-next-line no-continue- continue;- }-- const opts = (job.queueOptions || {}) as TQueueOptions;-- // Check if already in Redis (avoid duplicates)- // eslint-disable-next-line no-await-in-loop- const existingJob = await q.getJob(job.jobId);- if (existingJob) {- logger.debug({ jobId: job.jobId, queueName }, "Job already in Redis, skipping");- // eslint-disable-next-line no-continue- continue;- }-- // For failed jobs, run immediately (no delay)- // For pending jobs with delay, recalculate based on original schedule- let adjustedDelay: number | undefined;- const isFailedJob = job.status === PersistenceQueueStatus.Failed;-- if (!isFailedJob && opts.delay && opts.delay > 0) {- const originalScheduledTime = new Date(job.createdAt).getTime() + opts.delay;- adjustedDelay = Math.max(0, originalScheduledTime - Date.now());- }-- // Re-queue the job- // eslint-disable-next-line no-await-in-loop- await q.add(job.queueJobName as TQueueJobTypes[typeof queueName]["name"], job.queueData as never, {- ...opts,- delay: adjustedDelay,- jobId: job.jobId- });-- logger.info(- { jobId: job.jobId, queueName, adjustedDelay, wasFailedJob: isFailedJob },- "Job recovered and re-queued"- );- }-- totalRecovered += jobsInBatch.length;- offset += RECOVERY_BATCH_SIZE;- }-- // eslint-disable-next-line no-await-in-loop- await new Promise((resolve) => {- setTimeout(resolve, 10); // time to breathe for db- });- } while (jobsInBatch.length === RECOVERY_BATCH_SIZE);-- logger.info({ totalRecovered }, "Queue startup recovery completed");- } catch (error) {- logger.error(error, "Queue startup recovery failed");- }- };-- /**- * Handle a stuck job - either re-queue it or mark it as dead- */- const handleStuckJob = async (dbJob: TQueueJobs) => {- const queueName = dbJob.queueName as QueueName;- const q = queueContainer[queueName];- if (!q) return;-- const newAttempts = dbJob.attempts + 1;-- if (newAttempts >= dbJob.maxAttempts) {- // Mark as dead - exceeded max retries- await queueJobsDAL.update(- { id: dbJob.id },- {- status: PersistenceQueueStatus.Dead,- attempts: newAttempts,- errorMessage: `Exceeded max attempts (${dbJob.maxAttempts}) after being stuck`- }- );-- logger.error({ jobId: dbJob.jobId, queueName, attempts: newAttempts }, "Job marked as dead");-- // Remove from Redis if exists- try {- const redisJob = await q.getJob(dbJob.jobId);- if (redisJob) await redisJob.remove();- } catch {- // Ignore removal errors- }- return;- }-- // Reset to pending with incremented attempts- await queueJobsDAL.update(- { id: dbJob.id },- {- status: PersistenceQueueStatus.Pending,- attempts: newAttempts,- startedAt: null,- lastHeartBeat: null,- errorMessage: `Re-queued after stuck detection (attempt ${newAttempts}/${dbJob.maxAttempts})`- }- );-- // Remove from Redis and re-add- try {- const redisJob = await q.getJob(dbJob.jobId);- if (redisJob) await redisJob.remove();- } catch {- // Ignore removal errors- }-- const opts = (dbJob.queueOptions || {}) as TQueueOptions;- await q.add(dbJob.queueJobName as TQueueJobTypes[typeof queueName]["name"], dbJob.queueData as never, {- ...opts,- jobId: dbJob.jobId,- delay: undefined // Execute immediately on retry- });-- logger.info({ jobId: dbJob.jobId, queueName, attempt: newAttempts }, "Stuck job re-queued");- };-- /**- * Reconciliation Function- * Checks for stuck jobs and re-queues them- */- const runReconciliation = async () => {- logger.debug("Running queue reconciliation check...");-- if (persistentQueueConfigs.size === 0) return;-- try {- // Iterate through each persistent queue- for await (const [queueName, config] of persistentQueueConfigs.entries()) {- // Find stuck jobs for this specific queue- const stuckJobs = await queueJobsDAL.findStuckJobsByQueue(queueName, config.stuckThresholdMs);-- if (stuckJobs.length > 0) {- logger.info({ queueName, count: stuckJobs.length }, "Found stuck jobs for reconciliation");- }-- // Process stuck jobs sequentially to avoid race conditions- // eslint-disable-next-line no-await-in-loop- for await (const job of stuckJobs) {- await handleStuckJob(job);- }- }- } catch (error) {- logger.error(error, "Queue reconciliation failed");- }- };-- const initialize = async () => {- const appCfg = getConfig();-- const fipsSettings = crypto.isFipsModeEnabled() ? { settings: { repeatKeyHashAlgorithm: "sha256" as const } } : {};-- // Initialize internal recovery queue (BullMQ for distributed coordination)- queueContainer[QueueName.QueueInternalRecovery] = new Queue(QueueName.QueueInternalRecovery, {- prefix: isClusterMode ? `{${QueueName.QueueInternalRecovery}}` : undefined,- ...fipsSettings,- connection- });-- // Initialize internal reconciliation queue- queueContainer[QueueName.QueueInternalReconciliation] = new Queue(QueueName.QueueInternalReconciliation, {- ...fipsSettings,- prefix: isClusterMode ? `{${QueueName.QueueInternalReconciliation}}` : undefined,- connection- });-- if (appCfg.QUEUE_WORKERS_ENABLED) {- // Start recovery worker- workerContainer[QueueName.QueueInternalRecovery] = new Worker(- QueueName.QueueInternalRecovery,- async () => {- await startupRecovery();- },- {- ...fipsSettings,- prefix: isClusterMode ? `{${QueueName.QueueInternalRecovery}}` : undefined,- connection- }- );-- // Start reconciliation worker- workerContainer[QueueName.QueueInternalReconciliation] = new Worker(- QueueName.QueueInternalReconciliation,- async () => {- await runReconciliation();- },- {- ...fipsSettings,- prefix: isClusterMode ? `{${QueueName.QueueInternalReconciliation}}` : undefined,- connection- }- );-- // Schedule startup recovery job (runs once after 2 minutes)- await queueContainer[QueueName.QueueInternalRecovery].add(QueueJobs.QueueRecovery, undefined, {- jobId: "queue-startup-recovery",- delay: 2 * 60 * 1000,- removeOnComplete: true,- removeOnFail: true- });-- // Schedule reconciliation job (runs every 2 minutes)- // Uses the wrapper which handles legacy repeatable + orphaned delayed job cleanup.- // eslint-disable-next-line @typescript-eslint/no-use-before-define- await upsertJobScheduler(- QueueName.QueueInternalReconciliation,- `${JOB_SCHEDULER_PREFIX}:queue-reconciliation-cron`,- { pattern: "*/2 * * * *" },- {- name: QueueJobs.QueueReconciliation,- opts: { removeOnComplete: true, removeOnFail: true }- }- );-- logger.info("Internal queue recovery and reconciliation workers started");- }- };-const start: TQueueServiceFactory["start"] = (name, jobFn, queueSettings) => {if (queueContainer[name]) {throw new Error(`${name} queue is already initialized`);@@ -996,23 +651,18 @@ export const queueServiceFactory = (if (!appCfg.QUEUE_WORKERS_ENABLED) return;if (appCfg.QUEUE_WORKER_PROFILE === QueueWorkerProfile.Standard && NON_STANDARD_QUEUES.includes(name)) {- // only process standard jobsreturn;}if (appCfg.QUEUE_WORKER_PROFILE === QueueWorkerProfile.SecretScanning && !SECRET_SCANNING_QUEUES.includes(name)) {- // only process secret scanning jobsreturn;}- const { persistence, ...restQueueSettings } = queueSettings || {};-const fipsSettings = crypto.isFipsModeEnabled() ? { settings: { repeatKeyHashAlgorithm: "sha256" as const } } : {};queueContainer[name] = new Queue(name as string, {- // ref: docs.bullmq.io/bull/patterns/redis-clusterprefix: isClusterMode ? `{${name}}` : undefined,- ...restQueueSettings,+ ...queueSettings,...fipsSettings,connection});@@ -1021,72 +671,12 @@ export const queueServiceFactory = (return;}- // Check if persistence is enabled (either true or an object with enabled: true)- const isPersistenceEnabled = persistence === true || (typeof persistence === "object" && persistence.enabled);-- const wrappedJobFn = isPersistenceEnabled ? wrapJobWithHeartbeat(name, jobFn) : jobFn;-- workerContainer[name] = new Worker(name, wrappedJobFn, {+ workerContainer[name] = new Worker(name, jobFn, {prefix: isClusterMode ? `{${name}}` : undefined,...fipsSettings,- ...restQueueSettings,+ ...queueSettings,connection});-- if (isPersistenceEnabled) {- // Normalize persistence config (supports boolean or object)- const persistenceConfig =- typeof persistence === "object"- ? {- stuckThresholdMs: persistence.stuckThresholdMs ?? 5 * 60 * 1000,- maxAttempts: 1- }- : { stuckThresholdMs: 5 * 60 * 1000, maxAttempts: 1 };-- persistentQueueConfigs.set(name, persistenceConfig);- persistantQueues.add(name);-- workerContainer[name]?.on("active", (job) => {- if (job.id) {- void queueJobsDAL- .update(- { jobId: job.id, queueName: name },- {- status: PersistenceQueueStatus.Processing,- startedAt: new Date(),- errorMessage: null- }- )- .catch((err) => {- logger.error(err, "Failed to update queue job status active");- });- }- });-- workerContainer[name]?.on("completed", (job) => {- if (job.id) {- void queueJobsDAL- .update(- { jobId: job.id, queueName: name },- {- status: PersistenceQueueStatus.Completed,- completedAt: new Date()- }- )- .catch((err) => {- logger.error(err, "Failed to update queue job status completed");- });- }- });-- workerContainer[name]?.on("failed", (job, error) => {- if (job?.id) {- void queueJobsDAL.updateJobFailure(name, job.id, error.message).catch((err) => {- logger.error(err, "Failed to update queue job status failed");- });- }- });- }};const listen: TQueueServiceFactory["listen"] = (name, event, listener) => {@@ -1111,27 +701,6 @@ export const queueServiceFactory = (jobId};- if (persistantQueues.has(name)) {- await queueJobsDAL.transaction(async (tx) => {- await queueJobsDAL.create(- {- queueName: name,- queueType: "bullmq",- queueJobName: job,- jobId,- queueData: data,- queueOptions: finalOptions,- status: PersistenceQueueStatus.Pending,- maxAttempts: opts.attempts || 1- },- tx- );- // if this fails transaction rollback happens- await q?.add(job, data, finalOptions);- });- return;- }-await q?.add(job, data, finalOptions);};@@ -1182,11 +751,6 @@ export const queueServiceFactory = (const q = queueContainer[name];const job = await q?.getJob(jobId);- const isPersistantQueue = persistantQueues.has(name);- if (isPersistantQueue) {- await queueJobsDAL.delete({ jobId, queueName: name });- }-return job?.remove().catch(() => undefined);};@@ -1196,27 +760,9 @@ export const queueServiceFactory = (};const shutdown: TQueueServiceFactory["shutdown"] = async () => {- // Stop internal queue scheduler jobs- try {- const reconciliationQueue = queueContainer[QueueName.QueueInternalReconciliation];- await reconciliationQueue?.removeJobScheduler(`${JOB_SCHEDULER_PREFIX}:queue-reconciliation-cron`);- } catch {- // Ignore errors during shutdown- }-await Promise.all(Object.values(workerContainer).map((worker) => worker.close()));};- /**- * Update the heartbeat for a job to signal it's still alive- * Long-running jobs should call this periodically to avoid being marked as stuck- */- const updateJobHeartbeat: TQueueServiceFactory["updateJobHeartbeat"] = async (queueName, jobId) => {- if (!persistantQueues.has(queueName)) return;-- await queueJobsDAL.update({ queueName, jobId }, { lastHeartBeat: new Date() });- };-const upsertJobScheduler: TQueueServiceFactory["upsertJobScheduler"] = async (name,schedulerId,@@ -1310,7 +856,6 @@ export const queueServiceFactory = (};return {- initialize,start,listen,queue,@@ -1322,7 +867,6 @@ export const queueServiceFactory = (stopJobById,getRepeatableJobs,getDelayedJobs,- updateJobHeartbeat,upsertJobScheduler,removeJobScheduler,getJobSchedulersdiff --git a/backend/src/queue/queue-types.ts b/backend/src/queue/queue-types.tsdeleted file mode 100644index 755b7235d2..0000000000--- a/backend/src/queue/queue-types.ts+++ /dev/null@@ -1,8 +0,0 @@-export enum PersistenceQueueStatus {- Pending = "pending",- Processing = "processing",- Completed = "completed",- Failed = "failed",- Stuck = "stuck",- Dead = "dead"-}diff --git a/backend/src/server/routes/index.ts b/backend/src/server/routes/index.tsindex bbb7aa842e..86c72aaab7 100644--- a/backend/src/server/routes/index.ts+++ b/backend/src/server/routes/index.ts@@ -193,7 +193,6 @@ import { crypto } from "@app/lib/crypto/cryptography";import { BadRequestError } from "@app/lib/errors";import { logger } from "@app/lib/logger";import { TQueueServiceFactory } from "@app/queue";-import { queueJobsDALFactory } from "@app/queue/queue-jobs-dal";import { readLimit } from "@app/server/config/rateLimiter";import { registerSecretScanningV2Webhooks } from "@app/server/plugins/secret-scanner-v2";import { accessTokenQueueServiceFactory } from "@app/services/access-token-queue/access-token-queue";@@ -527,7 +526,6 @@ export const registerRoutes = async (const reminderDAL = reminderDALFactory(db);const reminderRecipientDAL = reminderRecipientDALFactory(db);- const queueJobsDAL = queueJobsDALFactory(db);const integrationDAL = integrationDALFactory(db);const offlineUsageReportDAL = offlineUsageReportDALFactory(db);@@ -2137,8 +2135,7 @@ export const registerRoutes = async (keyValueStoreDAL,approvalRequestDAL,approvalRequestGrantsDAL,- certificateRequestDAL,- queueJobsDAL+ certificateRequestDAL});const healthAlert = healthAlertServiceFactory({diff --git a/backend/src/services/app-connection/credential-rotation/app-connection-credential-rotation-queue.ts b/backend/src/services/app-connection/credential-rotation/app-connection-credential-rotation-queue.tsindex 3809cecd90..eccd5510dd 100644--- a/backend/src/services/app-connection/credential-rotation/app-connection-credential-rotation-queue.ts+++ b/backend/src/services/app-connection/credential-rotation/app-connection-credential-rotation-queue.ts@@ -50,50 +50,44 @@ export const appConnectionCredentialRotationQueueFactory = async ({}// Worker for individual rotation jobs- queueService.start(- QueueName.AppConnectionCredentialRotationRotate,- async (job) => {- const { rotationId, queuedAt, isManualRotation } = job.data;- const retryCount = job.attemptsMade;- const retryLimit = job.opts.attempts || 1;+ queueService.start(QueueName.AppConnectionCredentialRotationRotate, async (job) => {+ const { rotationId, queuedAt, isManualRotation } = job.data;+ const retryCount = job.attemptsMade;+ const retryLimit = job.opts.attempts || 1;- const logDetails = `[rotationId=${rotationId}] [jobId=${job.id}] retryCount=[${retryCount}/${retryLimit}]`;+ const logDetails = `[rotationId=${rotationId}] [jobId=${job.id}] retryCount=[${retryCount}/${retryLimit}]`;- try {- const rotation = await appConnectionCredentialRotationDAL.findByIdWithConnection(rotationId);-- if (!rotation) {- logger.warn(`credentialRotationQueue: Rotation ${rotationId} not found, skipping`);- return;- }+ try {+ const rotation = await appConnectionCredentialRotationDAL.findByIdWithConnection(rotationId);- if (!rotation.isAutoRotationEnabled && !isManualRotation) {- logger.info(`credentialRotationQueue: Skipping - Auto-Rotation Disabled ${logDetails}`);- return;- }-- if (rotation.lastRotatedAt && new Date(rotation.lastRotatedAt).getTime() >= new Date(queuedAt).getTime()) {- logger.info(`credentialRotationQueue: Skipping - Rotated Since Queue ${logDetails}`);- return;- }+ if (!rotation) {+ logger.warn(`credentialRotationQueue: Rotation ${rotationId} not found, skipping`);+ return;+ }- await appConnectionCredentialRotationService.rotateCredentials(rotationId, {- jobId: job.id || uuidv4(),- shouldSendNotification: true,- isFinalAttempt: retryCount + 1 >= retryLimit,- isManualRotation- });+ if (!rotation.isAutoRotationEnabled && !isManualRotation) {+ logger.info(`credentialRotationQueue: Skipping - Auto-Rotation Disabled ${logDetails}`);+ return;+ }- logger.info(`credentialRotationQueue: Credentials Rotated ${logDetails}`);- } catch (error) {- logger.error(error, `credentialRotationQueue: Failed to Rotate ${logDetails}`);- throw error;+ if (rotation.lastRotatedAt && new Date(rotation.lastRotatedAt).getTime() >= new Date(queuedAt).getTime()) {+ logger.info(`credentialRotationQueue: Skipping - Rotated Since Queue ${logDetails}`);+ return;}- },- {- persistence: true++ await appConnectionCredentialRotationService.rotateCredentials(rotationId, {+ jobId: job.id || uuidv4(),+ shouldSendNotification: true,+ isFinalAttempt: retryCount + 1 >= retryLimit,+ isManualRotation+ });++ logger.info(`credentialRotationQueue: Credentials Rotated ${logDetails}`);+ } catch (error) {+ logger.error(error, `credentialRotationQueue: Failed to Rotate ${logDetails}`);+ throw error;}- );+ });// Worker for scheduling and notificationsqueueService.start(QueueName.AppConnectionCredentialRotation, async (job) => {diff --git a/backend/src/services/certificate-authority/certificate-issuance-queue.ts b/backend/src/services/certificate-authority/certificate-issuance-queue.tsindex 041e156ae1..aae303ca7c 100644--- a/backend/src/services/certificate-authority/certificate-issuance-queue.ts+++ b/backend/src/services/certificate-authority/certificate-issuance-queue.ts@@ -180,7 +180,7 @@ export const certificateIssuanceQueueFactory = ({});/**- * Queue a certificate issuance job using pgBoss+ * Queue a certificate issuance job.*/const queueCertificateIssuance = async ({certificateId,diff --git a/backend/src/services/pam-session-expiration/pam-session-expiration-queue.ts b/backend/src/services/pam-session-expiration/pam-session-expiration-queue.tsindex 3c90ef5974..ab6192e50a 100644--- a/backend/src/services/pam-session-expiration/pam-session-expiration-queue.ts+++ b/backend/src/services/pam-session-expiration/pam-session-expiration-queue.ts@@ -21,30 +21,24 @@ export const pamSessionExpirationServiceFactory = ({return;}- queueService.start(- QueueName.PamSessionExpiration,- async (job) => {- const { sessionId } = job.data;- try {- logger.info({ sessionId }, `${QueueName.PamSessionExpiration}: expiring session`);- const updated = await pamSessionDAL.expireSessionById(sessionId);- if (updated > 0) {- logger.info({ sessionId }, `${QueueName.PamSessionExpiration}: session expired successfully`);- } else {- logger.info(- { sessionId },- `${QueueName.PamSessionExpiration}: session not expired (already ended or not found)`- );- }- } catch (error) {- logger.error(error, `${QueueName.PamSessionExpiration}: failed to expire session ${sessionId}`);- throw error;+ queueService.start(QueueName.PamSessionExpiration, async (job) => {+ const { sessionId } = job.data;+ try {+ logger.info({ sessionId }, `${QueueName.PamSessionExpiration}: expiring session`);+ const updated = await pamSessionDAL.expireSessionById(sessionId);+ if (updated > 0) {+ logger.info({ sessionId }, `${QueueName.PamSessionExpiration}: session expired successfully`);+ } else {+ logger.info(+ { sessionId },+ `${QueueName.PamSessionExpiration}: session not expired (already ended or not found)`+ );}- },- {- persistence: true+ } catch (error) {+ logger.error(error, `${QueueName.PamSessionExpiration}: failed to expire session ${sessionId}`);+ throw error;}- );+ });};// Schedule a session expiration job to run at the session's expiresAt timediff --git a/backend/src/services/resource-cleanup/resource-cleanup-queue.ts b/backend/src/services/resource-cleanup/resource-cleanup-queue.tsindex 92f053d63a..99c72b8a26 100644--- a/backend/src/services/resource-cleanup/resource-cleanup-queue.ts+++ b/backend/src/services/resource-cleanup/resource-cleanup-queue.ts@@ -5,7 +5,6 @@ import { TKeyValueStoreDALFactory } from "@app/keystore/key-value-store-dal";import { getConfig } from "@app/lib/config/env";import { logger } from "@app/lib/logger";import { JOB_SCHEDULER_PREFIX, QueueJobs, QueueName, TQueueServiceFactory } from "@app/queue";-import { TQueueJobsDALFactory } from "@app/queue/queue-jobs-dal";import { TUserNotificationDALFactory } from "@app/services/notification/user-notification-dal";import { TApprovalRequestDALFactory, TApprovalRequestGrantsDALFactory } from "../approval-policy/approval-request-dal";@@ -37,7 +36,6 @@ type TDailyResourceCleanUpQueueServiceFactoryDep = {approvalRequestDAL: Pick<TApprovalRequestDALFactory, "markExpiredRequests">;approvalRequestGrantsDAL: Pick<TApprovalRequestGrantsDALFactory, "markExpiredGrants">;certificateRequestDAL: Pick<TCertificateRequestDALFactory, "markExpiredApprovalRequests">;- queueJobsDAL: Pick<TQueueJobsDALFactory, "pruneQueueJobs">;};export type TDailyResourceCleanUpQueueServiceFactory = ReturnType<typeof dailyResourceCleanUpQueueServiceFactory>;@@ -59,8 +57,7 @@ export const dailyResourceCleanUpQueueServiceFactory = ({keyValueStoreDAL,approvalRequestDAL,approvalRequestGrantsDAL,- certificateRequestDAL,- queueJobsDAL+ certificateRequestDAL}: TDailyResourceCleanUpQueueServiceFactoryDep) => {const appCfg = getConfig();@@ -89,7 +86,6 @@ export const dailyResourceCleanUpQueueServiceFactory = ({await auditLogDAL.pruneAuditLog();await userNotificationDAL.pruneNotifications();await keyValueStoreDAL.pruneExpiredKeys();- await queueJobsDAL.pruneQueueJobs();const expiredApprovalRequestIds = await approvalRequestDAL.markExpiredRequests();if (expiredApprovalRequestIds.length > 0) {await certificateRequestDAL.markExpiredApprovalRequests(expiredApprovalRequestIds);