Repository navigation
Give account and workspace deletion a 60 s transaction timeout - #1567
Merged
Merged
Conversation
Deleting a workspace cascades into many large tables. On Cloud a self-deletion hit Prisma's default 5 s transaction timeout, rolled back and returned a 500 (Sentry CLOUD-BACKEND-4, 2026-11-06).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
On 2026-11-06 a Cloud user deleted their account in Settings and got a 500. The delete ran inside one Prisma transaction and hit Prisma's default 5 s transaction timeout (5,657 ms) in
organization.delete(), so it rolled back: the account and workspace stayed. Deleting a workspace cascades into many large shared tables, which can take longer than 5 s.This gives the two cascading deletes (account self-deletion and workspace deletion) a 60 s transaction timeout and a 10 s wait for a connection. Nothing else changes.
Behaviour is the same on Cloud and self-hosted; only the time limit of the two transactions changes.
Changes
common/cascade-delete-transaction.tswith the transaction options (maxWait10 s,timeout60 s).UsersService.deleteSelfandOrganizationsService.deleteOrganizationpass these options to$transaction.Type
Testing
Commands, run in
packages/backend:npx jest --maxWorkers=4 src/users/users.service.spec.ts src/organizations/organizations.service.spec.ts src/users/users.controller.delete-self.spec.ts: 3 suites, 45 tests passed.npx eslinton the five changed files: clean.npx tsc --noEmit -p tsconfig.json: no error in the changed files (the local node_modules missed two newer packages, so CI is the full check).Checklist
npm test)Related Issues
Sentry ANYTHINGMCP-CLOUD-BACKEND-4 (event of 2026-11-06 11:15 UTC). A possible follow-up, not in this PR: indexes on foreign keys that the cascade scans (
product_events.user_id,kg_nodes.connector_id). That is a schema change and needs its own issue.