Close db on finished api call
This commit is contained in:
parent
55bb9d47b4
commit
88646d10b2
3 changed files with 22 additions and 0 deletions
|
|
@ -64,6 +64,7 @@ class IdentGetter:
|
|||
'documentations': [sym.__dict__ for sym in symbol_doccomments]
|
||||
})
|
||||
resp.status = falcon.HTTP_200
|
||||
q.close()
|
||||
|
||||
def create_ident_getter():
|
||||
application = falcon.API()
|
||||
|
|
|
|||
18
data.py
18
data.py
|
|
@ -179,6 +179,9 @@ class BsdDB:
|
|||
if sync:
|
||||
self.db.sync()
|
||||
|
||||
def close(self):
|
||||
self.db.close()
|
||||
|
||||
class DB:
|
||||
def __init__(self, dir, readonly=True, dtscomp=False):
|
||||
if os.path.isdir(dir):
|
||||
|
|
@ -200,7 +203,22 @@ class DB:
|
|||
self.defs = BsdDB(dir + '/definitions.db', ro, DefList)
|
||||
self.refs = BsdDB(dir + '/references.db', ro, RefList)
|
||||
self.docs = BsdDB(dir + '/doccomments.db', ro, RefList)
|
||||
self.dtscomp = dtscomp
|
||||
if dtscomp:
|
||||
self.comps = BsdDB(dir + '/compatibledts.db', ro, RefList)
|
||||
self.comps_docs = BsdDB(dir + '/compatibledts_docs.db', ro, RefList)
|
||||
# Use a RefList in case there are multiple doc comments for an identifier
|
||||
|
||||
def close(self):
|
||||
self.vars.close()
|
||||
self.blob.close()
|
||||
self.hash.close()
|
||||
self.file.close()
|
||||
self.vers.close()
|
||||
self.defs.close()
|
||||
self.refs.close()
|
||||
self.docs.close()
|
||||
if self.dtscomp:
|
||||
self.comps.close()
|
||||
self.comps_docs.close()
|
||||
|
||||
|
|
|
|||
3
query.py
3
query.py
|
|
@ -62,6 +62,9 @@ class Query:
|
|||
"LXR_DATA_DIR": self.data_dir,
|
||||
}
|
||||
|
||||
def close(self):
|
||||
self.db.close()
|
||||
|
||||
def query(self, cmd, *args):
|
||||
if cmd == 'versions':
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue