Diff between ad3721178078f9469e54d90f689ab8268a5a5f41 and d565cc8dda58f86cbe266f6d1fb5803b8fac46db

Changed Files

File Additions Deletions Status
mesh/mesh-config-json.c +8 -0 modified

Full Patch

diff --git a/mesh/mesh-config-json.c b/mesh/mesh-config-json.c
index d3f423e..05b2a56 100644
--- a/mesh/mesh-config-json.c
+++ b/mesh/mesh-config-json.c
@@ -2012,6 +2012,14 @@ bool mesh_config_write_seq_number(struct mesh_config *cfg, uint32_t seq,
 		timersub(&now, &cfg->write_time, &elapsed);
 		elapsed_ms = elapsed.tv_sec * 1000 + elapsed.tv_usec / 1000;
 
+		/*
+		 * If time since last write is zero, this means that
+		 * idle_save_config is already pending, so we don't need to do
+		 * anything.
+		 */
+		if (!elapsed_ms)
+			return true;
+
 		cached = seq + (seq - cfg->write_seq) *
 					1000 * MIN_SEQ_CACHE_TIME / elapsed_ms;