(w http.ResponseWriter, r *http.Request)
| 189 | } |
| 190 | |
| 191 | func memoryLimitGetHandler(w http.ResponseWriter, r *http.Request) { |
| 192 | gqlReq := &schema.Request{ |
| 193 | Query: ` |
| 194 | query { |
| 195 | config { |
| 196 | cacheMb |
| 197 | } |
| 198 | }`, |
| 199 | } |
| 200 | resp := resolveWithAdminServer(gqlReq, r, adminServer) |
| 201 | if len(resp.Errors) != 0 { |
| 202 | x.SetStatus(w, resp.Errors[0].Message, "Get cache_mb failed") |
| 203 | return |
| 204 | } |
| 205 | var data struct { |
| 206 | Config struct { |
| 207 | CacheMb float64 |
| 208 | } |
| 209 | } |
| 210 | x.Check(json.Unmarshal(resp.Data.Bytes(), &data)) |
| 211 | |
| 212 | if _, err := fmt.Fprintln(w, data.Config.CacheMb); err != nil { |
| 213 | http.Error(w, err.Error(), http.StatusInternalServerError) |
| 214 | } |
| 215 | } |
no test coverage detected