From 5a10c6f59a9c918e70975f6f94a33fd0abacb679 Mon Sep 17 00:00:00 2001 From: Lluis Gifre <lluis.gifre@cttc.es> Date: Thu, 21 Oct 2021 22:07:55 +0200 Subject: [PATCH] Minor improvements in ORM framework. --- src/common/orm/Factory.py | 4 ++-- src/common/orm/backend/inmemory/InMemoryBackend.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/common/orm/Factory.py b/src/common/orm/Factory.py index 920d3974a..6ef0e11cc 100644 --- a/src/common/orm/Factory.py +++ b/src/common/orm/Factory.py @@ -27,6 +27,6 @@ def get_database_backend(backend : Optional[Union[str, BackendEnum]] = None, **s if backend is None: raise Exception('Database Backend not specified') if isinstance(backend, BackendEnum): backend = backend.value backend_class = BACKENDS.get(backend) - if backend_class is None: raise Exception('Unsupported DatabaseBackend({})'.format(backend)) - LOGGER.info('Selected Database Backend: {}'.format(backend)) + if backend_class is None: raise Exception('Unsupported DatabaseBackend({:s})'.format(backend)) + LOGGER.info('Selected Database Backend: {:s}'.format(backend)) return backend_class(**settings) diff --git a/src/common/orm/backend/inmemory/InMemoryBackend.py b/src/common/orm/backend/inmemory/InMemoryBackend.py index aaa9fc8a9..c960a1709 100644 --- a/src/common/orm/backend/inmemory/InMemoryBackend.py +++ b/src/common/orm/backend/inmemory/InMemoryBackend.py @@ -28,9 +28,9 @@ class InMemoryBackend(_Backend): for str_key in str_keys: if (str_key in self._keys) and (len(self._keys[str_key]) > 0) and (self._keys[str_key] != owner_key): # lock already acquired, cannot acquire all locks atomically - for str_key in acquired_lock_keys.keys(): - if str_key not in self._keys: continue - del self._keys[str_key] + for str_key_acquired in acquired_lock_keys: + if str_key_acquired not in self._keys: continue + del self._keys[str_key_acquired] return False, None # lock available, temporarily acquire it; locks will be released if some of them for a requested -- GitLab