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 secondary process must raise an exception if it can't
> acquire the lock.
Not that I've ever heard of django-pglocks before, but if I understand
the documentation at
https://github.com/Xof/django-pglocks#usage
correctly, would it simply be a matter of setting wait to False and
raising an exception is acquired is False?
Kind regards,
Kasper Laudrup