Fix parser test, fix handler

pull/1285/head
Paul Dix 2015-01-25 17:37:13 -05:00
parent f2d132b361
commit 7269647bfd
1 changed files with 14 additions and 0 deletions

View File

@ -94,6 +94,10 @@ func NewHandler(s *influxdb.Server, requireAuthentication bool, version string)
"ping-head",
"HEAD", "/ping", h.servePing, true,
},
route{ // Tell data node to run CQs that should be run
"process_continuous_queries",
"POST", "/process_continuous_queries", h.serveProcessContinuousQueries,
},
)
for _, r := range h.routes {
@ -322,6 +326,16 @@ func (h *Handler) serveDeleteDataNode(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusNoContent)
}
// serveProcessContinuousQueries will execute any continuous queries that should be run
func (h *Handler) serveProcessContinuousQueries(w http.ResponseWriter, r *http.Request, u *influxdb.User) {
if err := h.server.RunContinuousQueries(); err != nil {
httpError(w, err.Error(), http.StatusInternalServerError)
return
}
w.WriteHeader(http.StatusAccepted)
}
type dataNodeJSON struct {
ID uint64 `json:"id"`
URL string `json:"url"`