From 1c29f168c0f7d8a9d9ef0b816a9a12f19f34099b Mon Sep 17 00:00:00 2001
From: ale <ale@incal.net>
Date: Sat, 24 Sep 2011 10:25:11 +0100
Subject: [PATCH] renice the client when running as a daemon

---
 client/djrandom_client/client.py | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/client/djrandom_client/client.py b/client/djrandom_client/client.py
index 9a62592..729e173 100644
--- a/client/djrandom_client/client.py
+++ b/client/djrandom_client/client.py
@@ -50,16 +50,22 @@ def run_client(server_url, music_dir, api_key, run_once, bwlimit):
 
     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.setDaemon(True)
     scan.start()
 
     if not run_once:
+        # Run at a lower priority.
+        os.nice(10)
+
+        # Start the live filesystem watcher.
         if enable_watcher:
             wtch = watcher.Watcher(music_dir, upl.queue)
         else:
             log.warn('inotify/fsevents support not enabled on this platform')
 
+        # Install termination signal handlers.
         def _cleanup(signum, frame):
             if enable_watcher:
                 log.info('stopping watcher...')
-- 
GitLab