Open samcarton opened 1 month ago
Ideally it would just work, meaning that either we always set should prepare to false for Postgres (how important is it with the current driver?) or we default it based on whether the connection is multiplexing.
That said, I’m curious as to whether distributed locking works with a multiplexed Postgres connection. Is it still able to know which session is holding the lock?
Here the code is hard-coding
DatabaseConnection.ShouldPrepareCommands
to true: https://github.com/madelson/DistributedLock/blob/ce4a071dc2e87cf4295a9be4d1e20bbfe4a467e9/src/DistributedLock.Postgres/PostgresDatabaseConnection.cs#L36However we have npgsql's multiplexing enabled on the connection string, which doesn't allow explicit preparation (see related comment in issue). It results in a
Explicit preparation not supported with multiplexing
NotSupportedException
.PostgresDistributedSynchronizationProvider
.ShouldPrepareCommands
could be set tofalse
via options, then I assume we could also opt-out of the DistributedLock-multiplexing and rely on npgsql-Multiplexing instead. Do you see any issues with this?