Skip to content

Commit

Permalink
bug fix: btconfig will query mongodb for its attributes if not cached…
Browse files Browse the repository at this point in the history
…, so it's better to avoid accessing the same btconfig attribute in a parallel scenario, otherwise mongodb will raise an error of 'too many logical sessions'
  • Loading branch information
Yao Yao committed Aug 11, 2021
1 parent 16c6399 commit 48624ae
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/hub/databuild/mapper.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import biothings.hub.databuild.mapper as mapper
from biothings import config as btconfig
logging = btconfig.logger
max_id_length = btconfig.MAX_ID_LENGTH

class TagObserved(mapper.BaseMapper):

Expand All @@ -19,7 +20,7 @@ def load(self, *args, **kwargs):

def process(self,docs):
for doc in docs:
if len(doc["_id"]) > btconfig.MAX_ID_LENGTH:
if len(doc["_id"]) > max_id_length:
logging.debug("Skip doc, _id too long: %s" % doc["_id"])
continue
yield doc
Expand Down

0 comments on commit 48624ae

Please sign in to comment.