Commit 5a10c6f5 authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

Minor improvements in ORM framework.

parent ef3d2182
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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)
+3 −3
Original line number Diff line number Diff line
@@ -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