summaryrefslogtreecommitdiffstats
path: root/model/client4.go
diff options
context:
space:
mode:
authorCarlos Tadeu Panato Junior <ctadeu@gmail.com>2017-05-31 06:47:27 +0200
committerCorey Hulen <corey@hulen.com>2017-05-30 21:47:27 -0700
commitddc996f33fc39b2b8f4705d6e1232ccbad1ee4c7 (patch)
tree630c8b7b3970b2e79a5888fb9cd2c1722638cfbd /model/client4.go
parent0e4add96aebbd85d8ca7390ecc8b50ead9dbefac (diff)
downloadchat-ddc996f33fc39b2b8f4705d6e1232ccbad1ee4c7.tar.gz
chat-ddc996f33fc39b2b8f4705d6e1232ccbad1ee4c7.tar.bz2
chat-ddc996f33fc39b2b8f4705d6e1232ccbad1ee4c7.zip
[PLT-5465/APIV4] GET /system/health - Improve ping health check to have limits (#6331)
* implement PLT-5465 - Improve ping health check to have limits * update /ping and delete /health * remove permission check
Diffstat (limited to 'model/client4.go')
-rw-r--r--model/client4.go17
1 files changed, 10 insertions, 7 deletions
diff --git a/model/client4.go b/model/client4.go
index 28434c2e5..fce4c678f 100644
--- a/model/client4.go
+++ b/model/client4.go
@@ -1737,15 +1737,18 @@ func (c *Client4) GetFileInfosForPost(postId string, etag string) ([]*FileInfo,
}
}
-// General Section
-
-// GetPing will ping the server and to see if it is up and running.
-func (c *Client4) GetPing() (bool, *Response) {
- if r, err := c.DoApiGet(c.GetSystemRoute()+"/ping", ""); err != nil {
- return false, &Response{StatusCode: r.StatusCode, Error: err}
+// General/System Section
+
+// GetPing will return ok if the running goRoutines are below the threshold and unhealthy for above.
+func (c *Client4) GetPing() (string, *Response) {
+ if r, err := c.DoApiGet(c.GetSystemRoute()+"/ping", ""); r.StatusCode == 500 {
+ defer r.Body.Close()
+ return "unhealthy", &Response{StatusCode: r.StatusCode, Error: err}
+ } else if err != nil {
+ return "", &Response{StatusCode: r.StatusCode, Error: err}
} else {
defer closeBody(r)
- return CheckStatusOK(r), BuildResponse(r)
+ return MapFromJson(r.Body)["status"], BuildResponse(r)
}
}