Skip to content

Add optimistic locking - #11

Merged
DavidBadura merged 1 commit into
1.1.xfrom
optimistic-locking
Aug 31, 2026
Merged

Add optimistic locking#11
DavidBadura merged 1 commit into
1.1.xfrom
optimistic-locking

Conversation

@DavidBadura

@DavidBadura DavidBadura commented Aug 29, 2026

Copy link
Copy Markdown
Member

Mark an int property with #[Version] to guard update() against concurrent writes. The repository adds the loaded version to the update filter, bumps it, and throws OptimisticLockFailed when no document matched. On success the new version is written back onto the object so workers can keep updating the same instance.

Works the same on MongoDB and Rango. The version property must not be readonly because of the write-back & a second #[Version] or a readonly one fails when the metadata is built.

@DavidBadura DavidBadura added this to the 1.1.0 milestone Aug 29, 2026
@DavidBadura DavidBadura added the enhancement New feature or request label Aug 29, 2026
@DavidBadura
DavidBadura merged commit bba0e6e into 1.1.x Aug 31, 2026
18 of 20 checks passed
@DavidBadura
DavidBadura deleted the optimistic-locking branch August 31, 2026 13:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants