Skip to content

feat(postgres): remove lifetime from PgAdvisoryLockGuard#3495

Merged
abonander merged 2 commits into
transact-rs:mainfrom
bonsairobo:lockguard-lifetime
Jul 17, 2025
Merged

feat(postgres): remove lifetime from PgAdvisoryLockGuard#3495
abonander merged 2 commits into
transact-rs:mainfrom
bonsairobo:lockguard-lifetime

Conversation

@bonsairobo
Copy link
Copy Markdown

@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.
@abonander abonander merged commit 01d5443 into transact-rs:main Jul 17, 2025
84 checks passed
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