mirror of
https://github.com/moparisthebest/SickRage
synced 2024-12-04 07:02:26 -05:00
Merge pull request #1287 from abeloin/patch-unraid_link
Added detection of fs not implemented link creation
This commit is contained in:
commit
a086193fe2
@ -58,7 +58,11 @@ class CacheControlAdapter(HTTPAdapter):
|
|||||||
response = cached_response
|
response = cached_response
|
||||||
else:
|
else:
|
||||||
# try to cache the response
|
# try to cache the response
|
||||||
self.controller.cache_response(request, response)
|
try:
|
||||||
|
self.controller.cache_response(request, response)
|
||||||
|
except Exception as e:
|
||||||
|
# Failed to cache the results
|
||||||
|
pass
|
||||||
|
|
||||||
resp = super(CacheControlAdapter, self).build_response(
|
resp = super(CacheControlAdapter, self).build_response(
|
||||||
request, response
|
request, response
|
||||||
|
@ -5,6 +5,7 @@ import os
|
|||||||
|
|
||||||
from . import (LockBase, LockFailed, NotLocked, NotMyLock, LockTimeout,
|
from . import (LockBase, LockFailed, NotLocked, NotMyLock, LockTimeout,
|
||||||
AlreadyLocked)
|
AlreadyLocked)
|
||||||
|
import errno
|
||||||
|
|
||||||
class LinkLockFile(LockBase):
|
class LinkLockFile(LockBase):
|
||||||
"""Lock access to a file using atomic property of link(2).
|
"""Lock access to a file using atomic property of link(2).
|
||||||
@ -28,7 +29,9 @@ class LinkLockFile(LockBase):
|
|||||||
# Try and create a hard link to it.
|
# Try and create a hard link to it.
|
||||||
try:
|
try:
|
||||||
os.link(self.unique_name, self.lock_file)
|
os.link(self.unique_name, self.lock_file)
|
||||||
except OSError:
|
except OSError as e:
|
||||||
|
if e.errno == errno.ENOSYS:
|
||||||
|
raise LockFailed("%s" % e.strerror)
|
||||||
# Link creation failed. Maybe we've double-locked?
|
# Link creation failed. Maybe we've double-locked?
|
||||||
nlinks = os.stat(self.unique_name).st_nlink
|
nlinks = os.stat(self.unique_name).st_nlink
|
||||||
if nlinks == 2:
|
if nlinks == 2:
|
||||||
|
Loading…
Reference in New Issue
Block a user