Move stray magic values to literals.py in the checkout app. gh-issue #225.

This commit is contained in:
Roberto Rosario
2015-07-10 16:14:21 -04:00
parent aec8263ad8
commit c3be4bef53
3 changed files with 7 additions and 3 deletions

View File

@@ -5,9 +5,9 @@ import logging
from lock_manager import Lock, LockError
from mayan.celery import app
from .literals import CHECKOUT_EXPIRATION_LOCK_EXPIRE
from .models import DocumentCheckout
LOCK_EXPIRE = 50
logger = logging.getLogger(__name__)
@@ -17,7 +17,7 @@ def task_check_expired_check_outs():
lock_id = 'task_expired_check_outs'
try:
logger.debug('trying to acquire lock: %s', lock_id)
lock = Lock.acquire_lock(lock_id, LOCK_EXPIRE)
lock = Lock.acquire_lock(name=lock_id, timeout=CHECKOUT_EXPIRATION_LOCK_EXPIRE)
logger.debug('acquired lock: %s', lock_id)
DocumentCheckout.objects.check_in_expired_check_outs()
lock.release()