Skip to content
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

feat(postgres): remove lifetime from PgAdvisoryLockGuard #3495

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

bonsairobo
Copy link

@bonsairobo bonsairobo commented Sep 9, 2024

This is a breaking change.

Unlike with CPU synchronization primitives, there is no semantic requirement that the guard borrows the lock object.

We preserve the optimization of memoizing the release query by wrapping it in an Arc. This way all instances of PgAdvisoryLockGuard that originate from the same lock will share a single instance of the release query.

Does your PR solve an issue?

fixes #3429

Unlike with CPU synchronization primitives, there is no semantic requirement
that the guard borrows the lock object.

We preserve the optimization of memoizing the release query by wrapping it in
an Arc. This way all instances of `PgAdvisoryLockGuard` that originate from the
same lock will share a single instance of the release query.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AdvisoryLockGuard without lifetime
2 participants