Reduce file lock time

This commit is contained in:
Kovid Goyal 2019-03-16 11:09:23 +05:30
parent 138a0338f7
commit 8921bb8324
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -219,9 +219,9 @@ class DynamicConfig(dict):
d = {}
if os.path.exists(self.file_path):
with ExclusiveFile(self.file_path) as f:
raw = f.read()
raw = f.read().strip()
try:
d = cPickle.loads(raw) if raw.strip() else {}
d = cPickle.loads(raw) if raw else {}
except SystemError:
pass
except Exception: