[ARVADOS] updated: 499e303783a9b5430147ac4eef3bd13ff72968b9

Git user git at public.curoverse.com
Mon Jul 17 14:26:34 EDT 2017


Summary of changes:
 services/keepstore/handlers.go | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

       via  499e303783a9b5430147ac4eef3bd13ff72968b9 (commit)
      from  436613a082fbce366ba9f588796f95a113c7d244 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 499e303783a9b5430147ac4eef3bd13ff72968b9
Author: radhika <radhika at curoverse.com>
Date:   Mon Jul 17 14:25:46 2017 -0400

    11906: pass a func() to healthCheckDo from HealthCheckPingHandler
    
    Arvados-DCO-1.1-Signed-off-by: Radhika Chippada <radhika at curoverse.com>

diff --git a/services/keepstore/handlers.go b/services/keepstore/handlers.go
index 5e85ed6..3de6c9f 100644
--- a/services/keepstore/handlers.go
+++ b/services/keepstore/handlers.go
@@ -620,21 +620,25 @@ func UntrashHandler(resp http.ResponseWriter, req *http.Request) {
 	}
 }
 
-var pingResponseOK = map[string]string{"health": "OK"}
-
 // HealthCheckPingHandler processes "GET /_health/ping" requests
 func HealthCheckPingHandler(resp http.ResponseWriter, req *http.Request) {
-	healthCheckDo(resp, req, pingResponseOK)
+	fn := func() interface{} {
+		return map[string]string{"health": "OK"}
+	}
+	healthCheckDo(resp, req, fn)
 }
 
-func healthCheckDo(resp http.ResponseWriter, req *http.Request, v interface{}) {
+// Any health check handlers can pass this "func" which returns json to healthCheckDo
+type healthCheckFunc func() interface{}
+
+func healthCheckDo(resp http.ResponseWriter, req *http.Request, fn healthCheckFunc) {
 	msg, code := healthCheckAuth(resp, req)
 	if msg != "" {
 		http.Error(resp, msg, code)
 		return
 	}
 
-	ok, err := json.Marshal(v)
+	ok, err := json.Marshal(fn())
 	if err != nil {
 		http.Error(resp, err.Error(), 500)
 	}

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list