Skip to content

Commit

Permalink
Add back a log when SeqRepo obj is created
Browse files Browse the repository at this point in the history
  • Loading branch information
theferrit32 committed Oct 6, 2023
1 parent 20e73c3 commit 41b6e16
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/seqrepo_rest_service/threadglobals.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@

def get_seqrepo():
seqrepo_dir = current_app.config["seqrepo_dir"]
if _get_or_create("seqrepo", None, False) is None:
_logger.info("Opening seqrepo_dir=%s", seqrepo_dir)
return _get_or_create("seqrepo", lambda: SeqRepo(root_dir=seqrepo_dir))


def _get_or_create(k, f):
k = '_' + k
def _get_or_create(k, f, create=True):
k = "_" + k
o = getattr(_get_or_create, k, None)
if o is None:
if o is None and create:
o = f()
setattr(_get_or_create, k, o)
return o

0 comments on commit 41b6e16

Please sign in to comment.