From 11293b35ecd655bee9af44e64bcf5a1fe50f53d3 Mon Sep 17 00:00:00 2001
From: Jorrit Schaap <schaap@astron.nl>
Date: Mon, 4 Apr 2016 12:19:20 +0000
Subject: [PATCH] Task #8887: do not send change notifications if new and old
 are equal

---
 .../ResourceAssignmentDatabase/radbpglistener.py            | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/SAS/ResourceAssignment/ResourceAssignmentDatabase/radbpglistener.py b/SAS/ResourceAssignment/ResourceAssignmentDatabase/radbpglistener.py
index f286deda3ea..44ce4e052cc 100644
--- a/SAS/ResourceAssignment/ResourceAssignmentDatabase/radbpglistener.py
+++ b/SAS/ResourceAssignment/ResourceAssignmentDatabase/radbpglistener.py
@@ -123,6 +123,12 @@ class RADBPGListener(PostgresListener):
     def _sendNotification(self, subject, payload, timestampFields = None):
         try:
             content = json.loads(payload)
+
+            if 'new' in content and 'old' in content:
+                if content['new'] == content['old']:
+                    logger.info('new and old values are equal, not sending notification. %s' % (content['new']))
+                    return
+
             if timestampFields:
                 content = self._formatTimestampsAsIso(timestampFields, content)
         except Exception as e:
-- 
GitLab