Skip to content
Snippets Groups Projects
Commit 1c29f168 authored by ale's avatar ale
Browse files

renice the client when running as a daemon

parent ccaaee09
No related branches found
No related tags found
No related merge requests found
...@@ -50,16 +50,22 @@ def run_client(server_url, music_dir, api_key, run_once, bwlimit): ...@@ -50,16 +50,22 @@ def run_client(server_url, music_dir, api_key, run_once, bwlimit):
upl = upload.Uploader(server_url.rstrip('/'), api_key) upl = upload.Uploader(server_url.rstrip('/'), api_key)
# Start the full filesystem scan in the background.
scan = FullScan(music_dir, upl.queue, run_once) scan = FullScan(music_dir, upl.queue, run_once)
scan.setDaemon(True) scan.setDaemon(True)
scan.start() scan.start()
if not run_once: if not run_once:
# Run at a lower priority.
os.nice(10)
# Start the live filesystem watcher.
if enable_watcher: if enable_watcher:
wtch = watcher.Watcher(music_dir, upl.queue) wtch = watcher.Watcher(music_dir, upl.queue)
else: else:
log.warn('inotify/fsevents support not enabled on this platform') log.warn('inotify/fsevents support not enabled on this platform')
# Install termination signal handlers.
def _cleanup(signum, frame): def _cleanup(signum, frame):
if enable_watcher: if enable_watcher:
log.info('stopping watcher...') log.info('stopping watcher...')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment