Skip to content

Give account and workspace deletion a 60 s transaction timeout - #1567

Merged
helpcodeai merged 1 commit into
mainfrom
fix/account-delete-tx-timeout
Nov 7, 2026
Merged

helpcodeai merged 1 commit into
mainfrom
fix/account-delete-tx-timeout

Conversation

@helpcodeai

Copy link
Copy Markdown
Contributor

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

  • New common/cascade-delete-transaction.ts with the transaction options (maxWait 10 s, timeout 60 s).
  • UsersService.deleteSelf and OrganizationsService.deleteOrganization pass these options to $transaction.
  • Specs check that both transactions get the options.

Type

  • Bug fix
  • New feature
  • Documentation
  • Refactoring
  • Performance improvement
  • Other (describe below)

Testing

  • Added/updated unit tests
  • Tested manually (describe steps below)
  • No tests needed (explain why)

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 eslint on 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

  • My code follows the existing code style
  • I have tested my changes locally
  • I have updated documentation (if applicable)
  • All existing tests pass (npm test)
  • This PR has a descriptive title

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.

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).
@helpcodeai
helpcodeai enabled auto-merge (squash) November 7, 2026 08:12
@helpcodeai
helpcodeai merged commit 80cd6dd into main Nov 7, 2026
17 checks passed
@helpcodeai
helpcodeai deleted the fix/account-delete-tx-timeout branch November 7, 2026 08:24
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 7, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant