diff --git a/cachet_url_monitor/configuration.py b/cachet_url_monitor/configuration.py index 626bb8a..c557a65 100644 --- a/cachet_url_monitor/configuration.py +++ b/cachet_url_monitor/configuration.py @@ -83,6 +83,7 @@ class Configuration(object): # We need the current status so we monitor the status changes. This is necessary for creating incidents. self.status = get_current_status(self.api_url, self.component_id, self.headers) + self.previous_status = self.status # Get remaining settings self.public_incidents = int(os.environ.get('CACHET_PUBLIC_INCIDENTS') or self.data['cachet']['public_incidents']) @@ -180,6 +181,10 @@ class Configuration(object): """Pushes the status of the component to the cachet server. It will update the component status based on the previous call to evaluate(). """ + if self.previous_status == self.status: + return + self.previous_status = self.status + params = {'id': self.component_id, 'status': self.status} component_request = requests.put('%s/components/%d' % (self.api_url, self.component_id), params=params, headers=self.headers)