1
0
mirror of https://github.com/moparisthebest/SickRage synced 2024-12-04 15:12:23 -05:00

Merge pull request #1287 from abeloin/patch-unraid_link

Added detection of fs not implemented link creation
This commit is contained in:
Alexandre Beloin 2015-02-15 18:25:13 -05:00
commit a086193fe2
2 changed files with 9 additions and 2 deletions

View File

@ -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
try:
self.controller.cache_response(request, response) 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

View File

@ -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: