From a7ec49c6adcb034c68e83eeff80341c6f6895ef5 Mon Sep 17 00:00:00 2001 From: Travis Date: Wed, 11 Oct 2017 10:56:30 -0500 Subject: [PATCH] Adjust the documentation. Rename endpoint to `recalculate-caches` --- docs/api-reference.md | 8 +++++--- handler.go | 2 +- handler_test.go | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/docs/api-reference.md b/docs/api-reference.md index 887bd5e5f..5129f4061 100644 --- a/docs/api-reference.md +++ b/docs/api-reference.md @@ -414,12 +414,14 @@ Response: ### Recalculate Caches -`POST /recalculatecaches` +`POST /recalculate-caches` Recalculates the caches on demand. The cache is recalculated every 10 -secondes by default. This endpoint can be used to recalculate the cache +seconds by default. This endpoint can be used to recalculate the cache before the 10 second interval. This should probably only be used in -integration tests and not in a typical production workflow. +integration tests and not in a typical production workflow. Note that +in a multi-node cluster, the cache is only recalculated on the node +that receives the request. Response: `204 No Content` diff --git a/handler.go b/handler.go index b90d6be83..bae161515 100644 --- a/handler.go +++ b/handler.go @@ -134,7 +134,7 @@ func NewRouter(handler *Handler) *mux.Router { router.HandleFunc("/slices/max", handler.handleGetSliceMax).Methods("GET") router.HandleFunc("/status", handler.handleGetStatus).Methods("GET") router.HandleFunc("/version", handler.handleGetVersion).Methods("GET") - router.HandleFunc("/recalculatecaches", handler.handleRecalculateCaches).Methods("POST") + router.HandleFunc("/recalculate-caches", handler.handleRecalculateCaches).Methods("POST") // TODO: Apply MethodNotAllowed statuses to all endpoints. // Ideally this would be automatic, as described in this (wontfix) ticket: diff --git a/handler_test.go b/handler_test.go index a57c0da50..1524a30b8 100644 --- a/handler_test.go +++ b/handler_test.go @@ -1792,7 +1792,7 @@ func TestHandler_RecalculateCaches(t *testing.T) { h.Cluster = test.NewCluster(1) w := httptest.NewRecorder() - h.ServeHTTP(w, test.MustNewHTTPRequest("POST", "/recalculatecaches", nil)) + h.ServeHTTP(w, test.MustNewHTTPRequest("POST", "/recalculate-caches", nil)) if w.Code != http.StatusNoContent { t.Fatalf("unexpected status code: %d", w.Code) }