diff --git a/client/djrandom_client/client.py b/client/djrandom_client/client.py index 590c584c0ab740b8a8b18af1f7482f39a10e612b..003bf472ad9a2ed0c6b6843687f47d970021155d 100644 --- a/client/djrandom_client/client.py +++ b/client/djrandom_client/client.py @@ -37,12 +37,17 @@ class FullScan(threading.Thread): def run(self): while True: - filescan.recursive_scan(self.basedir, self.queue) + # 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: