Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
quadrismegistus committed Sep 6, 2024
1 parent 0539246 commit 0bd3f66
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion hashstash/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = '0.2.9'
__version__ = '0.2.10'
from .constants import *
from .config import *
from .hashstash import *
Expand Down
4 changes: 3 additions & 1 deletion hashstash/engines/lmdb.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from . import *
import lmdb

class LMDBHashStash(BaseHashStash):
engine = 'lmdb'
Expand All @@ -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:
Expand Down

0 comments on commit 0bd3f66

Please sign in to comment.