Skip to content

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

fix: resolved test failing due to transaction locking

=973311e99cac
diff --git a/backend/src/services/org/org-service.ts b/backend/src/services/org/org-service.ts
index e4b2f7092a..021eb31e00 100644
--- a/backend/src/services/org/org-service.ts
+++ b/backend/src/services/org/org-service.ts
@@ -870,19 +870,20 @@ export const orgServiceFactory = ({
await licenseService.cancelOrgSubscription(orgId);
}
- const response = await orgDAL.transaction(async (tx) => {
- const projects = await projectDAL.find({ orgId }, { tx });
-
- for await (const project of projects) {
- await fnDeleteProjectSecretReminders(project.id, {
- secretDAL,
- secretV2BridgeDAL,
- reminderService,
- projectBotService,
- folderDAL
- });
- }
+ // Outside the transaction: the cleanup runs its own queries per project, and inside it each
+ // concurrent delete would hold one pooled connection while waiting on a second.
+ const projects = await projectDAL.find({ orgId });
+ for await (const project of projects) {
+ await fnDeleteProjectSecretReminders(project.id, {
+ secretDAL,
+ secretV2BridgeDAL,
+ reminderService,
+ projectBotService,
+ folderDAL
+ });
+ }
+ const response = await orgDAL.transaction(async (tx) => {
const deletedOrg = await orgDAL.deleteById(orgId, tx);
// Generate new tokens without the organization ID present