diff --git a/proxy/cache.go b/proxy/cache.go index f824f8b..15398b3 100644 --- a/proxy/cache.go +++ b/proxy/cache.go @@ -54,7 +54,7 @@ func (c *cache) get(id cacheID) (*cachedResponse, bool) { return response, ok } -func (c *cache) flush() { +func (c *cache) update() { c.RLock() defer c.RUnlock() c.cacheMap = cacheMap{} diff --git a/proxy/proxy.go b/proxy/proxy.go index f944782..d8798e4 100644 --- a/proxy/proxy.go +++ b/proxy/proxy.go @@ -111,8 +111,8 @@ func getLoop( for { select { case command := <-chanFlush: - l.Info("cache flush command coming in", zap.String("flushCommand", string(command))) - c.flush() + l.Info("cache update command coming in", zap.String("flushCommand", string(command))) + c.update() c.callWebHooks() case nextJob := <-chanRequestJob: id := getCacheIDForRequest(nextJob.request) diff --git a/proxy/proxy_test.go b/proxy/proxy_test.go index 9ac202b..1a05247 100644 --- a/proxy/proxy_test.go +++ b/proxy/proxy_test.go @@ -15,7 +15,7 @@ const ( responseFoo = `i am a foo response` responseBar = `i am bar response` responseUpdate = `update` - responseFlush = `flush` + responseFlush = `update` ) type getStats func(path string) int @@ -72,7 +72,7 @@ func GetWebHook(t *testing.T) (getStats, http.HandlerFunc) { case "/update": w.Write([]byte(responseUpdate)) return - case "/flush": + case "/update": w.Write([]byte(responseFlush)) return } @@ -96,7 +96,7 @@ func getTestServer(t *testing.T) (gs func(path string) int, ws func(path string) "", []WebHookURL{ WebHookURL(webHookServer.URL + "/update"), - WebHookURL(webHookServer.URL + "/flush"), + WebHookURL(webHookServer.URL + "/update"), }, ) s = httptest.NewServer(p) @@ -135,6 +135,6 @@ func TestProxy(t *testing.T) { // assert.Equal(t, 1, ws("/update")) - assert.Equal(t, 1, ws("/flush")) + assert.Equal(t, 1, ws("/update")) }