From cce03c1feb3a7526b720bd50a6676df81aec8fff Mon Sep 17 00:00:00 2001
From: Adhidarma Hadiwinoto <me@adhisimon.org>
Date: Fri, 16 Dec 2016 14:37:00 +0700
Subject: [PATCH] healthy core status

---
 lib/pull.js | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/lib/pull.js b/lib/pull.js
index 42f6688..8e6823d 100644
--- a/lib/pull.js
+++ b/lib/pull.js
@@ -28,17 +28,24 @@ function pullTask() {
 
     request(options, function(error, response, body) {
         if (error) {
-            logger.warn('Error pulling task from CORE', {error: error});
+            if (matrix.core_is_healthy) {
+                logger.warn('Error pulling task from CORE', {error: error});
+            }
             matrix.core_is_healthy = false;
             return;
         }
 
         if (response.statusCode != 200) {
-            logger.warn('CORE http response status code for pull task is not 200', {http_response_status: response.statusCode});
+            if (matrix.core_is_healthy) {
+                logger.warn('CORE http response status code for pull task is not 200', {http_response_status: response.statusCode});
+            }
             matrix.core_is_healthy = false;
             return;
         }
 
+        if (!matrix.core_is_healthy) {
+            logger.verbose('CORE is healthy');
+        }
         matrix.core_is_healthy = true;
 
         if (body == 'NONE') {
-- 
1.9.0