Add plugable locking backend support. Add threadsafe file lock backend.

This commit is contained in:
Roberto Rosario
2016-11-13 03:50:09 -04:00
parent f5e3d5a8f2
commit 44531bd92a
12 changed files with 155 additions and 65 deletions

View File

@@ -0,0 +1,10 @@
from __future__ import unicode_literals
from django.apps import apps
class ModelLock(object):
@classmethod
def acquire_lock(cls, name, timeout=None):
Lock = apps.get_model(app_label='lock_manager', model_name='Lock')
return Lock.objects.acquire_lock(name=name, timeout=timeout)