From 1ba877b325c6d2275a066eef2b4324637acc1c2a Mon Sep 17 00:00:00 2001 From: Colin Date: Mon, 31 Jul 2023 11:06:04 +0000 Subject: [PATCH] upnp-forward: add a timeout to the unit especially, this lets the target die, and the timer restart, when the UPNP stuff hangs --- modules/ports.nix | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/modules/ports.nix b/modules/ports.nix index 0bd9d829..b2fd2570 100644 --- a/modules/ports.nix +++ b/modules/ports.nix @@ -47,9 +47,11 @@ let lib.mkIf portCfg.visibleTo.wan { "upnp-forward-${port}" = { description = "forward port ${port} from upstream gateway to this host"; - serviceConfig.Type = "oneshot"; restartTriggers = [(builtins.toJSON portCfg)]; + serviceConfig.Type = "oneshot"; + serviceConfig.TimeoutSec = "6min"; + after = [ "network.target" ]; wantedBy = [ "upnp-forwards.target" ]; script = @@ -120,9 +122,9 @@ in systemd.timers.upnp-forwards = { wantedBy = [ "network.target" ]; timerConfig = { - OnStartupSec = "1min"; + OnStartupSec = "75s"; OnCalendar = cfg.upnpRenewInterval; - RandomizeDelaySec = "2min"; + RandomizeDelaySec = "30s"; Unit = "upnp-forwards.target"; }; };