Skip to content

Postgres: Add support for transaction-scoped advisory locks with external DB connections #213

Description

@Tzachi009

Hi, I noticed that since version 1.1.0 of DistributedLock.Postgres, the library supports transaction-scoped advisory locks, if you choose to use them. I understand that it was added as part of the following issue - #168, as it turned out that using prepared statements/session-scoped advisory locks with PgBouncer is problematic.

The problem is that we must use PgBouncer, but in our case the app uses the library by passing an already established DB connection with a transaction, in order to have a better integrity of the lock. When I looked into the code of the library, I realized that the transaction locks are not supported for external connections:

image

I wonder why that is.
Is the issue that it will be the user's responsibilty to explicitly release the lock by commiting/rollbacking the transaction?
Will it be possible to add support for such scenarios?

Thanks.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions