Re: How to check if lock is acquired in Django pglock

2021-09-23 Thread Kasper Laudrup
On 23/09/2021 17.12, Sencer Hamarat wrote: Thanks for reply, Afterwards, I figured out it was like in your comment. Good to hear and thanks for sharing the solution. Kind regards, Kasper Laudrup -- You received this message because you are subscribed to the Google Groups "Django users" gr

Re: How to check if lock is acquired in Django pglock

2021-09-23 Thread Sencer Hamarat
Thanks for reply, Afterwards, I figured out it was like in your comment. Solution: lock_id = "non_unique_lock" with advisory_lock(lock_id, wait=False) as acquired: if acquired: # things to do else: raise Exception() # or whatever you want. Regards, Sencer HAMARAT On

Re: How to check if lock is acquired in Django pglock

2021-09-22 Thread Kasper Laudrup
On 22/09/2021 17.18, Sencer Hamarat wrote: Say, I have code block lie this:            lock_id = "non_unique_lock" with advisory_lock(lock_id, wait=True) as acquired: # things to do While one process has the lock, when the secondary process runs the same code block, the secon

Re: How to check if lock is acquired in Django pglock

2021-09-22 Thread Sencer Hamarat
Say, I have code block lie this: lock_id = "non_unique_lock" with advisory_lock(lock_id, wait=True) as acquired: # things to do While one process has the lock, when the secondary process runs the same code block, the secondary process must raise an exception if it can't acquire th