deja-dup-team team mailing list archive
-
deja-dup-team team
-
Mailing list archive
-
Message #00679
[Merge] lp:~naufraghi/deja-dup/nice-monitor into lp:deja-dup
Matteo Bertini has proposed merging lp:~naufraghi/deja-dup/nice-monitor into lp:deja-dup.
Requested reviews:
Déjà Dup Developers (deja-dup-hackers)
For more details, see:
https://code.launchpad.net/~naufraghi/deja-dup/nice-monitor/+merge/277190
This patche factorizes a common `nice_prefix` function in CommonUtils.vala and uses it both from utils and from monitor.vala
The old code in monitor was using an hardcoded legacy nice values and was never as idle as the new utils code.
Warning. These are my first lines in vala
--
Your team Déjà Dup Developers is requested to review the proposed merge of lp:~naufraghi/deja-dup/nice-monitor into lp:deja-dup.
=== modified file 'deja-dup/monitor/monitor.vala'
--- deja-dup/monitor/monitor.vala 2014-05-04 22:01:18 +0000
+++ deja-dup/monitor/monitor.vala 2015-11-10 22:04:18 +0000
@@ -175,26 +175,9 @@
// Don't run right now if an instance is already running
if (pid == (Pid)0 && !op_active) {
try {
- string[] argv = new string[8];
- int i = 0;
-
debug("Running automatic backup.");
-
- if (Environment.find_program_in_path("nice") != null)
- argv[i++] = "nice";
-
- if (Environment.find_program_in_path("ionice") != null) {
- // lowest priority in best-effort class
- // (can't use idle class as normal user on <2.6.25)
- argv[i++] = "ionice";
- argv[i++] = "-c2";
- argv[i++] = "-n7";
- }
-
- argv[i++] = "deja-dup";
- argv[i++] = "--backup";
- argv[i++] = "--auto";
- argv[i++] = null;
+ var command = DejaDup.nice_prefix("deja-dup --backup --auto");
+ string[] argv = command.split(" ");
if (DejaDup.in_testing_mode()) {
// fake successful and schedule next run
=== modified file 'libdeja/CommonUtils.vala'
--- libdeja/CommonUtils.vala 2013-10-15 04:36:06 +0000
+++ libdeja/CommonUtils.vala 2015-11-10 22:04:18 +0000
@@ -101,11 +101,9 @@
(major == req_major && minor == req_minor && micro >= req_micro);
}
-public void run_deja_dup(string args, AppLaunchContext? ctx = null,
- List<File>? files = null)
+public string nice_prefix(string command)
{
- var cmd = "deja-dup %s".printf(args);
-
+ var cmd = command;
int major, minor, micro;
var utsname = Posix.utsname();
parse_version(utsname.release, out major, out minor, out micro);
@@ -127,6 +125,13 @@
else if (Environment.find_program_in_path("nice") != null)
cmd = "nice -n19 " + cmd;
+ return cmd;
+}
+
+public void run_deja_dup(string args, AppLaunchContext? ctx = null,
+ List<File>? files = null)
+{
+ var cmd = nice_prefix("deja-dup %s".printf(args));
var flags = AppInfoCreateFlags.SUPPORTS_STARTUP_NOTIFICATION |
AppInfoCreateFlags.SUPPORTS_URIS;
try {
Follow ups