The problem here is that unlocking the advisory lock fails if the current transaction is aborted. We could manage the transaction state more carefully to avoid this, but I think a better solution is probably to use `pg_try_advisory_xact_lock` to acquire a transaction-level advisory lock instead, as that way we won't need to unlock it explicitly.
The problem here is that unlocking the advisory lock fails if the current transaction is aborted. We could manage the transaction state more carefully to avoid this, but I think a better solution is probably to use `pg_try_ advisory_ xact_lock` to acquire a transaction-level advisory lock instead, as that way we won't need to unlock it explicitly.