Dolda2000 GitWeb
/
didex.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
de73859
)
Registed datastore environments with atexit.
author
Fredrik Tolf
<fredrik@dolda2000.com>
Fri, 24 Jul 2015 16:04:14 +0000
(18:04 +0200)
committer
Fredrik Tolf
<fredrik@dolda2000.com>
Fri, 24 Jul 2015 16:04:14 +0000
(18:04 +0200)
didex/store.py
patch
|
blob
|
blame
|
history
diff --git
a/didex/store.py
b/didex/store.py
index
cc97a5b
..
a9bf0cd
100644
(file)
--- a/
didex/store.py
+++ b/
didex/store.py
@@
-1,4
+1,4
@@
-import threading, pickle, inspect
+import threading, pickle, inspect
, atexit
from . import db, index, cache
from .db import txnfun
from . import db, index, cache
from .db import txnfun
@@
-22,11
+22,13
@@
class environment(object):
if self.path is None:
self.path = self.getpath()
self.bk = db.environment(self.path, recover=self.recover)
if self.path is None:
self.path = self.getpath()
self.bk = db.environment(self.path, recover=self.recover)
+ atexit.register(self.close)
return self.bk
def close(self):
with self.lk:
if self.bk is not None:
return self.bk
def close(self):
with self.lk:
if self.bk is not None:
+ atexit.unregister(self.close)
self.bk.close()
self.bk = None
self.bk.close()
self.bk = None