From 8a73986f67c717961dc62cf11c8b0458ab04cc05 Mon Sep 17 00:00:00 2001
From: Jakob Olsson <jakob.olsson@iopsys.eu>
Date: Tue, 26 Nov 2024 15:09:53 +0000
Subject: [PATCH] make backhaul upgrade timers more aggressive first 4 attempts

---
 src/agent.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/src/agent.c b/src/agent.c
index 545638bb1..83b959224 100644
--- a/src/agent.c
+++ b/src/agent.c
@@ -3759,9 +3759,13 @@ static void agent_upgrade_backhaul_cb(atimer_t *t)
 	wifi_bsta_check_cac_done(a);
 
 	if (a->progress_attempts == 1)
-		timeout = 60 * 5; /* 5 minutes */
-	else if (a->progress_attempts >= 2)
-		timeout = 60 * 30; /* 30 minutes */
+		timeout = 60; /* 1 minute */
+	else if (a->progress_attempts == 2)
+		timeout = 4 * 60; /* 4 minutes */
+	else if (a->progress_attempts == 3)
+		timeout = 6 * 60; /* 6 minutes */
+	else if (a->progress_attempts >= 4)
+		timeout = 30 * 60; /* 30 minutes */
 
 	if (agent_has_downstream(a) && !a->progressing) {
 		timer_set(&a->upgrade_backhaul_scheduler,
@@ -3772,7 +3776,6 @@ static void agent_upgrade_backhaul_cb(atimer_t *t)
 	if (!a->progressing) {
 		agent_exec_platform_scripts("bsta_scan_on_enabled");
 		a->progressing = true;
-		a->progress_attempts++;
 		timer_set(&a->upgrade_backhaul_scheduler, 15 * 1000);
 		timestamp_update(&a->dynbh_last_start);
 	} else {
@@ -3792,7 +3795,7 @@ static void agent_upgrade_backhaul_cb(atimer_t *t)
 		}
 
 		a->progressing = false;
-
+		a->progress_attempts++;
 		timer_set(&a->upgrade_backhaul_scheduler, timeout * 1000);
 		timestamp_update(&a->dynbh_last_end);
 	}
-- 
GitLab