Use a SHA256 hex digest of the secret key at the name of the lockfile.

Signed-off-by: Michael Price <loneviking72@gmail.com>
This commit is contained in:
Michael Price
2018-03-09 02:45:11 -04:00
committed by Roberto Rosario
parent 8a3f9c7e4e
commit f8cb63b11a
2 changed files with 4 additions and 1 deletions

View File

@@ -31,6 +31,7 @@ Next (2018-XX-XX)
- Add notification count inside a badge on the notification link.
- Add the MERC specifying javascript library usage.
- Documents without at least a version are not scanned for duplicates.
- Use a SHA256 hex digest of the secret key at the name of the lockfile. This makes the generation of the name repeatable while unique between installations.
2.8 (2018-02-27)
================

View File

@@ -1,5 +1,6 @@
from __future__ import unicode_literals
import hashlib
import logging
import json
import os
@@ -7,6 +8,7 @@ import threading
import time
import uuid
from django.conf import settings
from django.core.files import locks
from django.utils.encoding import force_text
@@ -21,7 +23,7 @@ lock = threading.Lock()
logger = logging.getLogger(__name__)
lock_file = os.path.join(
setting_temporary_directory.value, 'mayan_locks.tmp'
setting_temporary_directory.value, hashlib.sha256(settings.SECRET_KEY).hexdigest()
)
open(lock_file, 'a').close()
logger.debug('lock_file: %s', lock_file)