Closed MacyFonseca closed 1 year ago
The Postgres lock provider makes use of the built in Postgres locks, it uses a type of lock called an Advisory Lock - these can be created at will and are useful for locking program flows outside of the database.
Like any other locks in postgres, it creates a record for them in the pg_locks table, you can pull info on which advisory locks are currently active by querying with
SELECT objid, mode, granted FROM pg_locks WHERE locktype = 'advisory'
any granted "true" locks are currently active, and any granted "false" locks are in a waiting state
Thanks @AJHopper that's exactly right. @MacyFonseca check out some of the links in this docs page for more info on the underlying locks: https://github.com/madelson/DistributedLock/blob/master/docs/DistributedLock.Postgres.md
Thanks for the reply guys! I make the query suggested by @AJHopper and could see the locks (acquired and holding).
First of all, thanks for this amazing package. 🙂
I just want to ask where the locks are stored (while their not disposed) when we're using the Postgres lock Provider. Should we create a table to temporary store the locks or Postgres has mechanisms to deal whit them.