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

Support transactional level advisory locks #34

Closed
rsyring opened this issue Jun 17, 2021 · 3 comments
Closed

Support transactional level advisory locks #34

rsyring opened this issue Jun 17, 2021 · 3 comments

Comments

@rsyring
Copy link
Member

rsyring commented Jun 17, 2021

@yudistrange asked in #29 (comment):

One thing that I found missing in django-pglocks was the support for transaction level advisory locks in postgres.
I couldn't find these here either.
Is there a plan to include these in the future?

There isn't a plan. I'm not necessarily opposed, it would just be a matter of calling a different function. What's the use case? Do you just want the "rollback" semantics so that the lock drops when the transaction drops?

@yudistrange
Copy link

yudistrange commented Jun 24, 2021

Do you just want the "rollback" semantics so that the lock drops when the transaction drops?

Yep. That's just what I need.

Aside: Is there a reason you preferred the pg_advisory_lock over pg_advisory_xact_lock

@rsyring
Copy link
Member Author

rsyring commented Jun 24, 2021

Is there a reason you preferred the pg_advisory_lock over pg_advisory_xact_lock

In my reading and use cases, advisory locks are not typically used to guard database work. I'm under the impression that if it's database work that needs locking, then there are better and more precise locking semantics available in PostgreSQL for that. So, really, it just never occurred to me to use pg_advisory_xact_lock because I assumed there would never be a transaction in scope. In fact, for our use cases, the connection pool for our locking is completely different from the one we use for database queries.

You are welcome to create a PR for this support, I'm not opposed to adding it.

@rsyring
Copy link
Member Author

rsyring commented Aug 12, 2022

Closing due to inactivity.

@rsyring rsyring closed this as completed Aug 12, 2022
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

No branches or pull requests

2 participants