News for hackers. Stuff that matters.
Re:Distributed locking with Postgres advisory locks by sudhirj on Monday January 24, 2022 @05:22AM (#30055689)
Just a reminder to watch out for connection pooling problems when using advisory locks. If you've checked out a connection from your pool that you use from the time you take the lock to the time you release it, you'll be fine. If you operate on the pool itself, or checkout a connection from the pool each time send a query, there's no guarantee you're running subsequent queries on the same connection that you took the lock out on, or that you're releasing the lock you took (if you wind up releasing on a different connection).

I wrote up more details on https://sudhir.io/understanding-connections-pools

There are no comments on this comment yet.