mirror of
https://github.com/pocket-id/pocket-id.git
synced 2025-12-11 07:42:58 +03:00
[PR #392] fix: use transactions when operations involve multiple database queries #845
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Original Pull Request: https://github.com/pocket-id/pocket-id/pull/392
State: closed
Merged: Yes
Currently, the backend does not use database transactions, even when there are operations performed in sequence. For example:
4d049bbe24/backend/internal/service/user_service.go (L166-L194)where the user is loaded from the DB and then updatesThis can cause a number of problems if multiple requests happen in parallel, and in some cases could also have security implications.
This PR updates the backend's to add transactions where they are needed.