From 8d888b3396434079a7d3320d99dce4bb37ad38cc Mon Sep 17 00:00:00 2001
From: Thomas Gelf <thomas@gelf.net>
Date: Wed, 26 Mar 2014 10:35:45 +0000
Subject: [PATCH] Do not hammer web server on auto-refreshing failures

---
 public/js/icinga/loader.js | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/public/js/icinga/loader.js b/public/js/icinga/loader.js
index 2cbc6734e..ec5538936 100644
--- a/public/js/icinga/loader.js
+++ b/public/js/icinga/loader.js
@@ -316,11 +316,8 @@
 
             var refresh = req.getResponseHeader('X-Icinga-Refresh');
             if (refresh) {
-                // Hmmmm... .data() doesn't work here?
-                req.$target.data('lastUpdate', (new Date()).getTime());
                 req.$target.data('icingaRefresh', refresh);
             } else {
-                req.$target.removeData('icingaRefresh');
                 req.$target.removeData('lastUpdate');
             }
 
@@ -415,6 +412,7 @@
          * Regardless of whether a request succeeded of failed, clean up
          */
         onComplete: function (req, textStatus) {
+            req.$target.data('lastUpdate', (new Date()).getTime());
             delete this.requests[req.$target.attr('id')];
             this.icinga.ui.fadeNotificationsAway();
             this.icinga.ui.refreshDebug();