feat(postgres): add PgAdvisoryLockGuardOwned#3442
Conversation
This new lock guard can own an `Arc<PgAdvisoryLock>` without any lifetime, allowing it to be moved into spawned tasks.
|
@bonsairobo (moving the design discussion here) Re: #3429 (comment)
The only thing is the memoization of the release query: https://github.com/launchbadge/sqlx/blob/main/sqlx-postgres/src/advisory_lock.rs#L40 Which isn't strictly necessary I suppose. I was trying to amortize the allocation but at the end of the day it's going to be copied into the connection's buffer anyway. I'm not against just making the guard not borrow the lock anymore, but it'd be a breaking change to remove the lifetime parameter so it would have to wait for 0.9.0 if we went that route. |
That would be my preference. I'm OK to wait for a release. |
|
If you'd like to make those changes then, I'll tag this as Breaking. |
|
Superseded by #3495 |
This new lock guard can own an
Arc<PgAdvisoryLock>without any lifetime, allowing it to be moved into spawned tasks.Fixes #3429