Skip to content

optimistic locking #20

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

cubap
Copy link
Member

@cubap cubap commented Jun 24, 2025

related to CenterForDigitalHumanities/rerum_server_nodejs#198

header "If-Overwritten-Version" should match the __rerum.isOverWritten property.

@cubap cubap linked an issue Jun 24, 2025 that may be closed by this pull request
cubap added 6 commits June 25, 2025 11:40
Upgraded several dependencies including @babel packages, formidable, brace-expansion, and picocolors. Added @paralleldrive/cuid2 and @noble/hashes as new dependencies, and removed hexoid and to-fast-properties. These updates improve compatibility and address potential security or maintenance issues.
@cubap
Copy link
Member Author

cubap commented Jun 27, 2025

Ready for Review.

This Tiny change should consider incoming requests on the /overwrite path and passthrough the If-Overwritten-Version header or create one from the __rerum.isOverwritten value.

On a 409 error, the currentVersion should be passed back through with the error.

This change does not require any change to Services, RERUM, or Interfaces, but will never 409 until the upstream chain is in place.

}

// Check for __rerum.isOverwritten in body and use as If-Overwritten-Version header
const isOverwrittenValue = req.body?.__rerum?.isOverwritten
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think just let the header be the trigger and remove this check. It isn't doing much harm, but it means if I forget to scrub __rerum from the request body then I am triggering an optimistic locking overwrite.

@thehabes thehabes merged commit d934d13 into main Jul 1, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Updating Pages in RERUM in parallel can cause lost data
2 participants