Skip to content
Snippets Groups Projects
Commit 999c4941 authored by ale's avatar ale
Browse files

catch exceptions on the file scan; use "ionice" to lower our i/o priority on Linux

parent 566c9a73
No related branches found
No related tags found
No related merge requests found
......@@ -37,12 +37,17 @@ class FullScan(threading.Thread):
def run(self):
while True:
# Do a full scan every 3 days.
delay = 86400 * 3
try:
filescan.recursive_scan(self.basedir, self.queue)
except Exception, e:
log.error('Error in file scan: %s' % e)
delay = 3600
if self.exit_when_done:
self.queue.put(None)
break
# Do a full scan every 3 days.
time.sleep(86400 * 3)
time.sleep(delay)
def run_client(server_url, music_dir, api_key, run_once, bwlimit):
......@@ -59,6 +64,9 @@ def run_client(server_url, music_dir, api_key, run_once, bwlimit):
if not run_once:
# Run at a lower priority.
os.nice(10)
if os.path.exists('/usr/bin/ionice'):
# Set 'idle' I/O scheduling class, we won't disturb other programs.
os.system('/usr/bin/ionice -c 3 -p %d' % os.getpid())
# Start the live filesystem watcher.
if enable_watcher:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment