Spin up hard drives to prevent premature timeout when caching directories
This commit is contained in:
parent
d3eaa22f5a
commit
409ad460aa
@ -1614,6 +1614,18 @@ class FileSwitchManager(object):
|
|||||||
dirsToSearch = self.mediaDirectories
|
dirsToSearch = self.mediaDirectories
|
||||||
|
|
||||||
if dirsToSearch:
|
if dirsToSearch:
|
||||||
|
# Spin up hard drives to prevent premature timeout
|
||||||
|
randomFilename = u"RandomFile"+unicode(random.randrange(10000, 99999))+".txt"
|
||||||
|
for directory in dirsToSearch:
|
||||||
|
startTime = time.time()
|
||||||
|
if os.path.isfile(os.path.join(directory, randomFilename)):
|
||||||
|
randomFilename = u"RandomFile"+unicode(random.randrange(10000, 99999))+".txt"
|
||||||
|
if time.time() - startTime > constants.FOLDER_SEARCH_FIRST_FILE_TIMEOUT:
|
||||||
|
self.disabledDir = directory
|
||||||
|
self.folderSearchEnabled = False
|
||||||
|
return
|
||||||
|
|
||||||
|
# Actual directory search
|
||||||
newMediaFilesCache = {}
|
newMediaFilesCache = {}
|
||||||
startTime = time.time()
|
startTime = time.time()
|
||||||
for directory in dirsToSearch:
|
for directory in dirsToSearch:
|
||||||
@ -1647,6 +1659,17 @@ class FileSwitchManager(object):
|
|||||||
|
|
||||||
if highPriority and self.folderSearchEnabled:
|
if highPriority and self.folderSearchEnabled:
|
||||||
directoryList = self.mediaDirectories
|
directoryList = self.mediaDirectories
|
||||||
|
# Spin up hard drives to prevent premature timeout
|
||||||
|
randomFilename = u"RandomFile"+unicode(random.randrange(10000, 99999))+".txt"
|
||||||
|
for directory in directoryList:
|
||||||
|
startTime = time.time()
|
||||||
|
if os.path.isfile(os.path.join(directory, randomFilename)):
|
||||||
|
randomFilename = u"RandomFile"+unicode(random.randrange(10000, 99999))+".txt"
|
||||||
|
if time.time() - startTime > constants.FOLDER_SEARCH_FIRST_FILE_TIMEOUT:
|
||||||
|
self.disabledDir = directory
|
||||||
|
self.folderSearchEnabled = False
|
||||||
|
return
|
||||||
|
|
||||||
startTime = time.time()
|
startTime = time.time()
|
||||||
if filename and directoryList:
|
if filename and directoryList:
|
||||||
for directory in directoryList:
|
for directory in directoryList:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user