diff --git a/hashstash/__init__.py b/hashstash/__init__.py index 7f1c6ee..63e6ec0 100644 --- a/hashstash/__init__.py +++ b/hashstash/__init__.py @@ -1,4 +1,4 @@ -__version__ = '0.2.9' +__version__ = '0.2.10' from .constants import * from .config import * from .hashstash import * diff --git a/hashstash/engines/lmdb.py b/hashstash/engines/lmdb.py index e333cd4..926770c 100644 --- a/hashstash/engines/lmdb.py +++ b/hashstash/engines/lmdb.py @@ -1,5 +1,4 @@ from . import * -import lmdb class LMDBHashStash(BaseHashStash): engine = 'lmdb' @@ -13,13 +12,16 @@ def __init__(self, *args, map_size=10 * 1024**3, **kwargs): # Default to 10GB @log.debug def get_db(self): if self._env is None: + import lmdb os.makedirs(self.path_dirname, exist_ok=True) + self._env = lmdb.open(self.path, map_size=self.map_size) return self._env @contextmanager def get_transaction(self, write=False): + import lmdb max_retries = 3 for attempt in range(max_retries): try: