Handle race conditions when creating a directory for PersistentDict
Two threads may be creating it in parallel. Change-Id: Iaca9e648e2e5a0c71759e472f3f04ec15e0f0233
This commit is contained in:
parent
2c99cb4715
commit
5d1a146955
@ -78,8 +78,7 @@ class PersistentDict(MutableMapping):
|
||||
|
||||
def make_permanent(self, dbpath, dbfile):
|
||||
dbpath = dbpath or self.DBPATH
|
||||
if not os.path.exists(dbpath):
|
||||
os.makedirs(dbpath)
|
||||
os.makedirs(dbpath, exist_ok=True)
|
||||
|
||||
self._dbpath = os.path.join(dbpath, dbfile) + '.sqlite'
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user