[Fixed]-What clears the lock created by select_for_update in Django?

15👍

The lock is active for the duration of the transaction, which is controlled by you. So you control the granularity of the lock by controlling the granularity of the transaction, using the usual methods: @transaction.atomic, with transaction.atomic(), ATOMIC_REQUESTS = True, etc. See the transaction documentation.

Leave a comment