1
0
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:
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
else:
# 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(
request, response

View File

@ -5,6 +5,7 @@ import os
from . import (LockBase, LockFailed, NotLocked, NotMyLock, LockTimeout,
AlreadyLocked)
import errno
class LinkLockFile(LockBase):
"""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:
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?
nlinks = os.stat(self.unique_name).st_nlink
if nlinks == 2: