mirror of
https://github.com/yaroslaff/antifraud2gis.git
synced 2026-10-15 13:44:14 +00:00
catch exceptions, increased LMDB_MAP_SIZE
This commit is contained in:
parent
47caacf443
commit
6dc3b7ef53
2 changed files with 5 additions and 3 deletions
|
|
@ -4,6 +4,7 @@ import time
|
|||
import fnmatch
|
||||
import sys
|
||||
import gzip
|
||||
import zlib
|
||||
import traceback
|
||||
import numpy as np
|
||||
import lmdb
|
||||
|
|
@ -190,7 +191,7 @@ class Company:
|
|||
# print(f"Load company reviews from {self.reviews_path} mtime: {int(self.reviews_path.stat().st_mtime)} sz: {self.reviews_path.stat().st_size}")
|
||||
self._reviews = json.load(f)
|
||||
self.count_rate()
|
||||
except gzip.BadGzipFile:
|
||||
except (gzip.BadGzipFile, OSError, zlib.error):
|
||||
logger.error(f"Bad gzip file! {self.reviews_path}")
|
||||
sys.exit(1)
|
||||
else:
|
||||
|
|
@ -489,7 +490,8 @@ class Company:
|
|||
@staticmethod
|
||||
def resolve_oid(object_id: str):
|
||||
""" set self.title/address from user's reviews """
|
||||
env = lmdb.open(settings.lmdb_storage.as_posix(), map_size=LMDB_MAP_SIZE, readonly=True)
|
||||
# env = lmdb.open(settings.lmdb_storage.as_posix(), map_size=LMDB_MAP_SIZE, readonly=True)
|
||||
env = lmdb.open(settings.lmdb_storage.as_posix(), readonly=True)
|
||||
|
||||
with env.begin() as txn:
|
||||
jdata = txn.get(b"object:" + object_id.encode())
|
||||
|
|
|
|||
|
|
@ -21,4 +21,4 @@ REDIS_WORKER_STATUS_SET="af2gis:worker_status_set"
|
|||
REDIS_WORKER_STARTED="af2gis:worker_started"
|
||||
REDIS_DRAMATIQ_QUEUE="dramatiq:default"
|
||||
|
||||
LMDB_MAP_SIZE = 1 << 35
|
||||
LMDB_MAP_SIZE = 1 << 36
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue