mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 02:34:06 -04:00
Reduce file lock time
This commit is contained in:
parent
138a0338f7
commit
8921bb8324
@ -219,17 +219,17 @@ class DynamicConfig(dict):
|
||||
d = {}
|
||||
if os.path.exists(self.file_path):
|
||||
with ExclusiveFile(self.file_path) as f:
|
||||
raw = f.read()
|
||||
try:
|
||||
d = cPickle.loads(raw) if raw.strip() else {}
|
||||
except SystemError:
|
||||
pass
|
||||
except Exception:
|
||||
print('WARNING: Failed to unpickle stored config object, ignoring')
|
||||
if DEBUG:
|
||||
import traceback
|
||||
traceback.print_exc()
|
||||
d = {}
|
||||
raw = f.read().strip()
|
||||
try:
|
||||
d = cPickle.loads(raw) if raw else {}
|
||||
except SystemError:
|
||||
pass
|
||||
except Exception:
|
||||
print('WARNING: Failed to unpickle stored config object, ignoring')
|
||||
if DEBUG:
|
||||
import traceback
|
||||
traceback.print_exc()
|
||||
d = {}
|
||||
if clear_current:
|
||||
self.clear()
|
||||
self.update(d)
|
||||
|
Loading…
x
Reference in New Issue
Block a user