Add info about disabling locking to error message
This commit is contained in:
parent
217859bf5e
commit
1b54b23bb3
@ -1268,17 +1268,20 @@ class Collection(BaseCollection):
|
|||||||
flags = LOCKFILE_EXCLUSIVE_LOCK if mode == "w" else 0
|
flags = LOCKFILE_EXCLUSIVE_LOCK if mode == "w" else 0
|
||||||
overlapped = Overlapped()
|
overlapped = Overlapped()
|
||||||
if not lock_file_ex(handle, flags, 0, 1, 0, overlapped):
|
if not lock_file_ex(handle, flags, 0, 1, 0, overlapped):
|
||||||
raise RuntimeError("Locking the storage failed: %s" %
|
raise RuntimeError("Locking the storage failed "
|
||||||
ctypes.FormatError())
|
"(can be disabled in the config): "
|
||||||
|
"%s" % ctypes.FormatError())
|
||||||
elif os.name == "posix":
|
elif os.name == "posix":
|
||||||
_cmd = fcntl.LOCK_EX if mode == "w" else fcntl.LOCK_SH
|
_cmd = fcntl.LOCK_EX if mode == "w" else fcntl.LOCK_SH
|
||||||
try:
|
try:
|
||||||
fcntl.flock(cls._lock_file.fileno(), _cmd)
|
fcntl.flock(cls._lock_file.fileno(), _cmd)
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
raise RuntimeError("Locking the storage failed: %s" %
|
raise RuntimeError("Locking the storage failed "
|
||||||
e) from e
|
"(can be disabled in the config): "
|
||||||
|
"%s" % e) from e
|
||||||
else:
|
else:
|
||||||
raise RuntimeError("Locking the storage failed: "
|
raise RuntimeError("Locking the storage failed "
|
||||||
|
"(can be disabled in the config): "
|
||||||
"Unsupported operating system")
|
"Unsupported operating system")
|
||||||
cls._lock_file_locked = True
|
cls._lock_file_locked = True
|
||||||
try:
|
try:
|
||||||
|
Loading…
Reference in New Issue
Block a user