use per-user runtime stats path for reliable gsfd+tui updates
Tests / test_core_function (push) Failing after 11s
Tests / test_core_function (push) Failing after 11s
This commit is contained in:
@@ -73,7 +73,7 @@ Default config path:
|
|||||||
|
|
||||||
Default speed stats path:
|
Default speed stats path:
|
||||||
- `$XDG_RUNTIME_DIR/gsf-speed.txt` (if available)
|
- `$XDG_RUNTIME_DIR/gsf-speed.txt` (if available)
|
||||||
- fallback `~/.local/state/gsf/speed.txt`
|
- fallback `/tmp/gsf-speed.txt`
|
||||||
- override with `GSF_STATS_PATH`
|
- override with `GSF_STATS_PATH`
|
||||||
|
|
||||||
## runtime requirements
|
## runtime requirements
|
||||||
|
|||||||
@@ -44,6 +44,11 @@ fn stats_path() -> PathBuf {
|
|||||||
return PathBuf::from(path);
|
return PathBuf::from(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Keep default shared across sudo/non-sudo runs.
|
if let Ok(runtime_dir) = std::env::var("XDG_RUNTIME_DIR")
|
||||||
|
&& !runtime_dir.is_empty()
|
||||||
|
{
|
||||||
|
return PathBuf::from(runtime_dir).join("gsf-speed.txt");
|
||||||
|
}
|
||||||
|
|
||||||
PathBuf::from("/tmp/gsf-speed.txt")
|
PathBuf::from("/tmp/gsf-speed.txt")
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-1
@@ -367,6 +367,11 @@ fn stats_path() -> PathBuf {
|
|||||||
return PathBuf::from(path);
|
return PathBuf::from(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Keep default shared across sudo/non-sudo runs.
|
if let Ok(runtime_dir) = std::env::var("XDG_RUNTIME_DIR")
|
||||||
|
&& !runtime_dir.is_empty()
|
||||||
|
{
|
||||||
|
return PathBuf::from(runtime_dir).join("gsf-speed.txt");
|
||||||
|
}
|
||||||
|
|
||||||
PathBuf::from("/tmp/gsf-speed.txt")
|
PathBuf::from("/tmp/gsf-speed.txt")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -89,6 +89,7 @@ in
|
|||||||
wantedBy = ["default.target"];
|
wantedBy = ["default.target"];
|
||||||
after = ["graphical-session.target"];
|
after = ["graphical-session.target"];
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
|
Environment = ["GSF_STATS_PATH=%t/gsf-speed.txt"];
|
||||||
ExecStart = "${cfg.package}/bin/gsfd --device ${lib.escapeShellArg cfg.device}${lib.optionalString (cfg.extraArgs != []) " ${extraArgs}"}";
|
ExecStart = "${cfg.package}/bin/gsfd --device ${lib.escapeShellArg cfg.device}${lib.optionalString (cfg.extraArgs != []) " ${extraArgs}"}";
|
||||||
Restart = "on-failure";
|
Restart = "on-failure";
|
||||||
RestartSec = 1;
|
RestartSec = 1;
|
||||||
|
|||||||
Reference in New Issue
Block a user