From 244e90eb52ee43aa9884decf542e343872bd00c3 Mon Sep 17 00:00:00 2001
From: Niko Ehrenfeuchter <nikolaus.ehrenfeuchter@unibas.ch>
Date: Thu, 8 Feb 2018 17:13:57 +0100
Subject: [PATCH] Only serialize if the values have actually changed.

Do not serialize the status XML if the actual value of ServiceSuspended
and / or LimitReason has not really changed. This effectively prevent
the "heartbeat" value (LastStatusUpdate) from being updated once per
AutoTx timer cycle.
---
 ATxCommon/Serializables/ServiceStatus.cs | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/ATxCommon/Serializables/ServiceStatus.cs b/ATxCommon/Serializables/ServiceStatus.cs
index 3035e9e..f801973 100644
--- a/ATxCommon/Serializables/ServiceStatus.cs
+++ b/ATxCommon/Serializables/ServiceStatus.cs
@@ -154,6 +154,8 @@ namespace ATxCommon.Serializables
         public string LimitReason {
             get { return _limitReason; }
             set {
+                if (_limitReason == value) return;
+
                 _limitReason = value;
                 Log.Trace("LimitReason was updated ({0}).", value);
                 Serialize();
@@ -192,6 +194,8 @@ namespace ATxCommon.Serializables
         public bool ServiceSuspended {
             get { return _serviceSuspended; }
             set {
+                if (_serviceSuspended == value) return;
+
                 _serviceSuspended = value;
                 Log.Trace("ServiceSuspended was updated ({0}).", value);
                 Serialize();
-- 
GitLab