You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
with NonBlockingLock.objects.acquire_lock(lock_name='update_user_' + str(user.id)):
pass
...is too hard for me.
I think we can made API more shorter and pretty. In my vision it could be function which accepts lock_name argument and returns context manager, decorator or Lock instance.
from locking import db_locking
def update_user(request):
with db_locking.lock('update_user'):
pass
@db_locking.lock('update_user')
def update_user(request):
pass
def update_user(request):
lock = db_locking.lock('update_user')
lock.acquire()
lock.release()
What you think?
The text was updated successfully, but these errors were encountered:
Writing something like this:
...is too hard for me.
I think we can made API more shorter and pretty. In my vision it could be function which accepts
lock_name
argument and returns context manager, decorator or Lock instance.What you think?
The text was updated successfully, but these errors were encountered: